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

Actions2

Overview

The Zalo Send Message node allows users to send messages through the Zalo platform using its API, authenticated via a cookie-based login. It supports sending text messages to individual users or groups, with options for message urgency, quoting previous messages, mentioning users, and attaching images by URL.

This node is beneficial in scenarios such as:

  • Automating customer support replies on Zalo.
  • Broadcasting announcements or alerts to user groups.
  • Integrating Zalo messaging into workflows that require notifications or conversational interactions.

For example, a business could use this node to automatically send order status updates to customers or notify a team group 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 (0) or Group (1).
Message The text content of the message to send.
Urgency The urgency level of the message: Default (0), Important (1), or Urgent (2).
Quote Message Optional quoted message details to reply to a specific message, including Message ID, Sender ID, and Content.
Mentions Details of users mentioned in the message, including User ID, position in the message, and length of mention.
Attachments One or more image attachments specified by public URLs.

Output

The node outputs an array of JSON objects, each representing the result of sending a message for each input item. Each output JSON 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 object sent, including text, urgency, quotes, mentions, and attachments.

If sending fails and "Continue On Fail" is enabled, the output includes:

  • success: false
  • error: Error message describing the failure.

The node also handles temporary files for image attachments by downloading them before sending and removing them afterward.

Dependencies

  • Requires an API key credential with a valid Zalo cookie, IMEI, and user agent string for authentication.
  • Uses the external zca-js library to interact with the Zalo API.
  • Utilizes helper functions to download and remove image attachments locally before sending.
  • Requires proper configuration of credentials in n8n to provide the necessary authentication data.

Troubleshooting

  • Failed to initialize Zalo API. Check your credentials.
    This error indicates invalid or expired authentication data (cookie, IMEI, or user agent). Verify and update the credentials.

  • Zalo login error: followed by a message
    Indicates a problem during login to Zalo API. Check network connectivity and validity of credentials.

  • Cannot send typing event (logged but does not stop execution)
    Typing events are optional; failure here does not block message sending. Usually safe to ignore unless critical.

  • Error sending Zalo message: followed by a message
    General error when sending a message. Could be due to invalid parameters, network issues, or API limits. Review the error message and input parameters.

  • If attachments fail to send, ensure the image URLs are publicly accessible and valid.

  • When using mentions or quotes, ensure IDs and positions are correct to avoid malformed messages.

Links and References

Discussion