Zalo CN Send Message icon

Zalo CN 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 an API connection authenticated via a cookie-based login. It supports sending text messages to either individual users or groups, with options for quoting previous messages, mentioning users, attaching images/files by URL, and setting message urgency levels.

Common scenarios include:

  • Automating customer support replies on Zalo.
  • Broadcasting announcements or alerts to user groups.
  • Sending personalized messages with mentions and quoted content.
  • Attaching images or files hosted online to enrich messages.

For example, a business could use this node to send urgent notifications to a group chat, quoting a previous message for context, while tagging specific team members.

Properties

Name Meaning
Thread ID The ID of the conversation thread where the message will be sent.
Type The type of 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 quoted content.
Mentions Optional mention details specifying User ID, position in message, and length of mention.
Attachments One or more attachments specified by public URLs (images or files).

Output

The node outputs an array of JSON objects, each representing the result of sending a message for one 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 indicating whether the thread is a user or group.
  • messageContent: The full message payload sent, including text, urgency, quotes, mentions, and attachments.

If sending fails and the node is configured to continue on failure, the output includes:

  • success: false
  • error: The error message describing what went wrong.

The node does not output binary data.

Dependencies

  • Requires an API key credential that provides a valid Zalo cookie, IMEI, and user agent string for authentication.
  • Uses the external zalo-api-final library to interact with the Zalo API.
  • Utilizes helper functions to download and remove attachment files temporarily.
  • Requires proper configuration of credentials within n8n to enable cookie-based login.

Troubleshooting

  • Failed to initialize Zalo API: Indicates invalid or expired credentials. Verify the cookie, IMEI, and user agent values 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; the node attempts to send a typing indicator but continues even if it fails.
  • Error sending Zalo message: May occur due to invalid thread IDs, unsupported attachment URLs, or API rate limits. Review error messages and ensure all inputs are valid.
  • If the node is set to stop on failure, any error will halt execution; enabling "continue on fail" allows processing subsequent items.

Links and References

Discussion