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 messaging platform using its API, authenticated via a login session established with cookies. It supports sending text messages to either individual users or groups, with options for message urgency, quoting previous messages, mentioning users, and attaching images or files by URL.

Common scenarios include:

  • Automating customer support replies on Zalo.
  • Broadcasting announcements or alerts to user groups.
  • Sending personalized messages that reference earlier conversations.
  • Including media attachments in messages for richer communication.

For example, a business could use this node to send an urgent notification with an image attachment to a group chat, while quoting a previous message for context.

Properties

Name Meaning
Thread ID The ID of the conversation thread where the message will be sent.
Type The type of message recipient: "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 Content to reference.
Mentions Details of users to mention in the message, including User ID, position, and length.
Attachments One or more attachments specified by public URLs (images or files) to include in the message.

Output

The node outputs an array of JSON objects, each representing the result of sending a message for an 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 (0) or group (1).
  • messageContent: The full message payload sent, including text, urgency, quotes, mentions, and attachments if any.
  • If sending fails and "Continue On Fail" is enabled, an error message is included instead.

The node does not output binary data.

Dependencies

  • Requires an API key credential containing a valid Zalo login cookie, device IMEI, and user agent string.
  • Uses the external zca-js library to interact with the Zalo API.
  • Utilizes helper functions to download and remove attachment files temporarily.
  • Needs proper configuration of credentials with valid authentication cookies for Zalo.

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 due to network issues or incorrect credential format. Verify connectivity and credential correctness.
  • Cannot send typing event: Non-critical; the node logs this but continues. Usually caused by temporary API limitations.
  • Error sending Zalo message: May occur if thread ID is invalid, message content is empty, or attachments fail to download. Check input parameters and attachment URLs.
  • To handle failures gracefully, enable "Continue On Fail" so the node processes all items without stopping on errors.

Links and References

Discussion