Zalo Send Message icon

Zalo Send Message

Gửi tin nhắn qua API Zalo sử dụng kết nối đăng nhập bằng cookie

Actions2

Overview

The Zalo Send Message node enables 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.

This node is beneficial for automating communication workflows on Zalo, such as customer support notifications, group announcements, or personal reminders. For example, a business could automatically send order updates to customers or broadcast urgent alerts to a team group.

Properties

Name Meaning
Thread ID The unique identifier of the Zalo thread (user or group) where the message will be sent.
Type The type of the thread: User (individual chat) or Group (group chat).
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: ID of the message being quoted.
- Sender ID: ID of the sender of the quoted message.
- Content: Text content of the quoted message.
Mentions Optional mentions within the message specifying:
- User ID: ID of the user being mentioned.
- Position: Starting position of the mention in the message text.
- Length: Length of the mention text.
Attachments One or more image attachments specified by public URLs. Only image URLs are supported.

Output

The node outputs an array of JSON objects, each corresponding to an input item processed. Each output JSON 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 the thread type (0 for user, 1 for group).
  • messageContent: The full message object sent, including text, urgency, quotes, mentions, and attachments.

If sending fails and "Continue On Fail" is enabled, the output includes:

  • success: false
  • error: Error message describing the failure.

The node can handle binary data indirectly by downloading images from provided URLs and uploading them as attachments, but the final output only contains JSON metadata about the sent message.

Dependencies

  • Requires valid Zalo API credentials with a cookie, IMEI, and user agent string for authentication.
  • Uses the external zca-js library to interact with the Zalo API.
  • Utilizes helper functions to download and remove image attachments temporarily.
  • Requires proper configuration of the Zalo API credential in n8n with the necessary authentication details.

Troubleshooting

  • Failed to initialize Zalo API: Indicates invalid or expired credentials. Verify that the cookie, IMEI, and user agent are correct and up to date.
  • Zalo login error: Could be caused by network issues or incorrect credential format. Check connectivity and credential validity.
  • Cannot send typing event: Non-critical warning when the node fails to send a typing indicator; usually safe to ignore.
  • Error sending Zalo message: General failure during message sending. Check message parameters, thread IDs, and attachment URLs.
  • If attachments fail to upload, ensure the image URLs are publicly accessible and correctly formatted.
  • Enable "Continue On Fail" to allow processing multiple items even if some fail.

Links and References

Discussion