Actions2
- Zalo Send Message Actions
Overview
This node allows sending messages through the Zalo platform using its API, authenticated via a cookie-based login. It is designed to send text messages to either individual users or groups within Zalo threads. The node supports additional features such as quoting previous messages, mentioning users in the message, attaching images by URL, and setting the urgency level of the message.
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 use this node to:
- Send a personalized message to a user after they submit a form.
- Post an urgent update to a group chat with image attachments.
- Reply to a specific message in a thread by quoting it and mentioning relevant users.
Properties
| Name | Meaning |
|---|---|
| Thread ID | The unique identifier of the Zalo thread where the message will be sent. |
| Type | The type of the message recipient: User (individual) or Group. |
| Message | The text content of the message to be sent. |
| Urgency | The urgency level of the message: Default, Important, or Urgent. |
| Quote Message | Optional quoted message details to reply to a specific message, including Message ID, Sender ID, and Content. |
| Mentions | Details for mentioning users in the message, including User ID, position in the message, and length of mention. |
| Attachments | One or more image attachments specified by public URLs to include with the message. |
Output
The node outputs an array of JSON objects, each representing the result of sending a message for each input item. Each output object contains:
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 whether the message was sent to a user or group.messageContent: The full message payload sent, including text, urgency, quotes, mentions, and attachments.
If attachments were included, the node handles temporary saving and removal of these images during execution but does not output binary data directly.
Dependencies
- Requires valid Zalo API credentials configured in n8n, specifically an API key credential containing a cookie, IMEI, and user agent string.
- Uses the external
zca-jslibrary to interact with the Zalo API. - Utilizes helper functions to save and remove images temporarily when sending attachments.
- The node must be able to access the internet to reach Zalo's API endpoints and any image URLs provided.
Troubleshooting
Failed to initialize Zalo API. Check your credentials.
This error indicates invalid or missing authentication details. Verify that the cookie, IMEI, and user agent are correctly set in the credentials.Zalo login error: followed by a message
Indicates a failure during the login process to Zalo's API. Check network connectivity and credential validity.Zalo API not initialized
Occurs if the node attempts to send a message before successful login. Ensure credentials are correct and the login step completes without errors.Cannot send typing event
Sending a typing indicator is optional; failure here does not stop message sending. This may happen if the thread ID or type is incorrect or due to API limitations.If the node fails silently or returns
success: falsewith an error message, check the input parameters for correctness, especially thread IDs and message content.When sending attachments, ensure the image URLs are publicly accessible and valid. Invalid URLs may cause attachment upload failures.
Links and References
- Zalo Official API Documentation (in Vietnamese)
- n8n Documentation on Creating Custom Nodes
- zca-js GitHub Repository - unofficial JavaScript SDK for Zalo API (used internally)