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.

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, a business could automatically send order updates to customers or notify team members in a group chat about urgent issues.

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 Details of a message to quote in the new message, including Message ID, Sender ID, and Content.
Mentions Information about users to mention in the message, including User ID, position, and length.
Attachments One or more attachments to include, currently supporting image or file URLs.

Output

The node outputs an array with one item per input, each containing a JSON object with the following structure:

  • 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 (user or group).
  • messageContent: The full message object sent, including text, urgency, quotes, mentions, and attachments if any.
  • If an error occurs and the node is set to continue on failure, the output includes:
    • success: false
    • error: Error message describing what went wrong.

The node does not output binary data.

Dependencies

  • Requires an API key credential that provides a valid Zalo login session cookie, device IMEI, and user agent string.
  • Uses the external zca-js library to interact with the Zalo API.
  • Utilizes helper functions to save and remove files locally when handling attachments.
  • Requires proper configuration of credentials with valid Zalo authentication details.

Troubleshooting

  • Failed to initialize Zalo API: This error 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.
  • Cannot send typing event: Non-critical warning; the node attempts to send a typing indicator but continues even if it fails.
  • Error sending Zalo message: General failure during message sending, possibly due to invalid thread ID, message content, or API limits. Check parameters and API status.
  • When attachments are used, ensure URLs are publicly accessible and valid; otherwise, file saving may fail.
  • If the node is configured to stop on failure, any error will halt execution; enabling "continue on fail" allows processing subsequent items.

Links and References

Discussion