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

Overview

This node sends messages through the Zalo 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 personal messaging bots.

Practical examples:

  • Sending an urgent alert message to a user or group.
  • Quoting a previous message in a reply.
  • Mentioning specific users within a message.
  • Attaching one or more images by URL to enrich the message content.

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 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 Content to reference.
Mentions Details of users to mention in the message, including User ID, position, and length of mention.
Attachments One or more image attachments specified by public URLs to include in the message.

Output

The node outputs an array with one object per input item containing:

  • 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 an error occurs and the node is set to continue on failure, the output includes success: false and an error message string.

If binary data were involved (e.g., images), it would be handled internally by downloading and removing temporary files, but no binary output is exposed.

Dependencies

  • Requires an API key credential that provides a valid Zalo login cookie, IMEI, and user agent string.
  • Uses the external zca-js library to interact with the Zalo API.
  • Utilizes helper functions to download and remove image attachments temporarily.
  • Node configuration must include proper credentials with valid Zalo session cookies.

Troubleshooting

  • Failed to initialize Zalo API: Indicates invalid or expired credentials. Verify the cookie and related authentication data.
  • Zalo login error: Could be due to network issues or incorrect credential format. Check connectivity and credential correctness.
  • Cannot send typing event: Non-critical; the node logs this but continues. May happen if the thread ID is invalid or the API rejects the typing event.
  • Error sending Zalo message: Could result from invalid thread IDs, message content issues, or API limits. Review error messages and ensure all required fields are correct.
  • To handle errors gracefully, enable "Continue On Fail" in the node settings.

Links and References

Discussion