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 cookie-based login. It is useful for automating message sending to individual users or groups on Zalo, including text content, quoted messages, mentions, and image attachments. Practical applications include customer support notifications, marketing campaigns, or internal team communications where Zalo is the preferred messaging channel.

Properties

Name Meaning
Thread ID The ID of the conversation thread where the message will be sent.
Type The type of message recipient: either a single user or a group. Options: User, Group.
Message The text content of the message to send.
Urgency The urgency level of the message. Options: Default, Important, Urgent.
Quote Message Optional quoted message details to include in the message: Message ID, Sender ID, Content.
Mentions Optional mention details within the message: User ID, position in text, and length of mention.
Attachments One or more image attachments by public URL. Only Image URL type supported.

Output

The node outputs an array of JSON objects, each representing the result of sending a message for each 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 value indicating 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 an error occurs and "Continue On Fail" is enabled, the output includes:
    • success: false
    • error: Error message describing the failure.

The node does not output binary data.

Dependencies

  • Requires valid Zalo API credentials with a cookie, IMEI, and user agent string for authentication.
  • Uses the zca-js library to interact with the Zalo API.
  • Utilizes helper functions to download and remove images temporarily when sending attachments.
  • Requires configuration of the Zalo API credential in n8n with appropriate cookie and device info.

Troubleshooting

  • Failed to initialize Zalo API: Indicates invalid or expired credentials. Verify that the cookie, IMEI, and user agent are correct and up to date.
  • Zalo login error: Could be caused by network issues or incorrect credential format. Check connectivity and credential validity.
  • Error sending Zalo message: May occur due to invalid thread IDs, unsupported attachment URLs, or API limits. Validate all inputs and ensure attachments are accessible.
  • If attachments fail, confirm that image URLs are publicly accessible and correctly formatted.
  • Use the "Continue On Fail" option to handle errors gracefully without stopping the entire workflow.

Links and References

Discussion