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 cookie-based login. 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 with mentions and quoted content.
  • Sharing images or files hosted online as attachments in conversations.

For example, a business could use this node to send urgent notifications to a group chat, including images of new products, 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 the 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 a prior message.
Mentions Details about users mentioned in the message, including User ID, position in text, and length of mention.
Attachments One or more image/file attachments specified by URLs. Supports single URL or array of URLs (JSON or comma-separated).

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.
  • threadId: The ID of the thread where the message was sent.
  • threadType: Numeric code representing the thread type (user or group).
  • messageContent: The parameters used to send the message (text, urgency, quotes, mentions, attachments).
  • response: The raw response from the Zalo API after sending the message.

If sending fails and the node is configured to continue on failure, the output includes an error message instead of success.

The node handles attachments by downloading files from provided URLs temporarily, sending them, then removing the local copies. It logs warnings if file types may not be fully supported but attempts to send them anyway.

Dependencies

  • Requires an API key credential that provides a cookie string, device IMEI, and user agent for authenticating with the Zalo API.
  • Uses the external zca-js library for interacting with the Zalo API.
  • Utilizes helper functions to download and remove files from URLs before sending.
  • Requires proper configuration of credentials containing valid Zalo session cookies.

Troubleshooting

  • Failed to initialize Zalo API: Indicates invalid or expired credentials. Verify the cookie and authentication details are correct.
  • Failed to download file from URL: Check that attachment URLs are publicly accessible and correctly formatted.
  • Unsupported file type warning: Some file extensions might not be officially supported by Zalo; try converting files to common image formats like JPG or PNG.
  • Cannot send typing event: Non-critical; the node attempts to notify the recipient that the sender is typing but continues even if this fails.
  • If the node throws errors during message sending, enabling "Continue On Fail" allows processing subsequent items without stopping the workflow.

Links and References

Discussion