Overview
This node sends messages through the Zalo messaging platform using its API, authenticated via a cookie-based login. It supports sending text messages to either individual users or groups, with options for message urgency, quoting previous messages, mentioning users, and attaching images by URL.
Typical use cases include automating customer support replies, broadcasting announcements to groups, or integrating Zalo messaging into workflows that require notifications or alerts.
For example, you can send an urgent message quoting a previous conversation and mention specific users while attaching relevant images hosted online.
Properties
| Name | Meaning |
|---|---|
| Thread ID | The ID of the thread (user or group) where the message will be sent. |
| Type | The type of the message recipient: "User" or "Group". |
| Message | The content of the message to send. |
| Urgency | The urgency level of the message: "Default", "Important", or "Urgent". |
| Quote Message | Details of a message to quote, including Message ID, Sender ID, and quoted content. |
| Mentions | Information about users to mention in the message, including User ID, position, and length. |
| Attachments | One or more image attachments specified by public URLs. |
Output
The node outputs an array with one item per input message. Each output item contains a json object with the following fields:
success: Boolean indicating if the message was sent successfully.response: The raw response from the Zalo API after sending the message.threadId: The ID of the thread where the message was sent.threadType: Numeric code representing the thread type (0 for user, 1 for group).messageContent: The full message object sent, including text, urgency, quotes, mentions, and attachments if any.error(only on failure): Error message describing what went wrong.
If binary data were involved (e.g., file uploads), it would be handled internally by downloading and removing temporary files, but no binary output is exposed.
Dependencies
- Requires an API key credential containing a valid Zalo cookie, IMEI, and user agent string for authentication.
- Uses the external
zca-jslibrary to interact with the Zalo API. - Utilizes helper functions to download and remove image attachments from provided URLs.
- Must be configured with proper credentials in n8n before use.
Troubleshooting
- Failed to initialize Zalo API: Indicates invalid or expired credentials. Verify the cookie, IMEI, and user agent are correct and up to date.
- Zalo login error: Could be due to network issues or incorrect credential format. Check connectivity and credential validity.
- Cannot send typing event: Non-critical; the node logs this but continues. Usually caused by permission or API limitations.
- Error sending Zalo message: May occur if thread ID is invalid, message content is empty, or API limits are exceeded. Review error details in output and ensure all required properties are correctly set.
- If
continueOnFailis enabled, the node will continue processing subsequent items even if some fail.
Links and References
- Zalo Official API Documentation
- n8n Documentation - Creating Custom Nodes
- zca-js GitHub Repository (for the Zalo API client library)