Overview
This node sends messages through the Zalo messaging platform using its API, authenticated via a login session established with cookies. It supports sending messages to individual users or groups, including text content, quoted messages, mentions, and image attachments. This node is useful for automating communication workflows on Zalo, such as customer support notifications, group announcements, or personalized messaging campaigns.
Practical examples:
- Sending an urgent alert message to a specific user.
- Posting a group message with mentions to notify certain members.
- Replying to a message by quoting it and attaching images.
Properties
| Name | Meaning |
|---|---|
| Thread ID | The ID of the conversation thread where the message will be sent. |
| Type | The type of message recipient: either "User" (individual) or "Group". |
| Message | The text content of the message to send. |
| Urgency | The urgency level of the message: "Default", "Important", or "Urgent". |
| Quote Message | Optional quoted message details including Message ID, Sender ID, and quoted content. |
| Mentions | Optional mention details specifying User ID, position in the message, and length of the 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 value indicating whether the thread is a user (0) or group (1).messageContent: The full message payload sent, including text, urgency, quotes, mentions, and attachments if any.error(only if failed): Error message describing why sending failed.
If attachments are included, they are uploaded temporarily during execution and removed afterward.
Dependencies
- Requires an API key credential that provides a valid Zalo login session cookie, device IMEI, and user agent string.
- Uses the external
zca-jslibrary to interact with the Zalo API. - Utilizes helper functions to save and remove images from URLs for attachments.
- Requires proper configuration of credentials containing the necessary authentication data.
Troubleshooting
- Failed to initialize Zalo API: Indicates invalid or expired credentials (cookie, IMEI, or user agent). Re-authenticate or update credentials.
- Zalo login error: Could be caused by network issues or incorrect credential format. Verify connectivity and credential correctness.
- Error sending Zalo message: May occur due to invalid thread IDs, unsupported message types, or malformed attachment URLs. Check input parameters carefully.
- If the node is set to continue on failure, errors will be reported per item without stopping the workflow; otherwise, the node will throw an error and halt execution.
Links and References
- Zalo Official API Documentation
- n8n Documentation - Creating Custom Nodes
- zca-js GitHub Repository (for Zalo API client library)