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 is designed for automating message sending in personal or group conversations on Zalo.

Typical use cases include:

  • Sending notifications or alerts to individual users or groups.
  • Automating customer support or marketing messages.
  • Replying to specific messages by quoting them.
  • Mentioning users within messages to draw their attention.
  • Attaching images via public URLs to enrich messages.

For example, a business could automatically send an urgent update to a group chat or reply to a user's query by quoting their previous message.

Properties

Name Meaning
Thread ID The unique identifier of the conversation (thread) where the message will be sent.
Type The type of thread: either "User" (individual chat) or "Group" (group chat).
Message The text content of the message to be sent.
Urgency The urgency level of the message; options are "Default", "Important", and "Urgent".
Quote Message Optional message to quote/reply to, including Message ID, Sender ID, and quoted content.
Mentions Optional user mentions within the message, specifying User ID, position, 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 code representing the thread type (user or group).
  • messageContent: The full message object that was sent, including text, urgency, quotes, mentions, and attachments.

If the node encounters errors and is set to continue on failure, it outputs an object with success: false and an error message describing the issue.

The node does not output binary data.

Dependencies

  • Requires an API key credential containing 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 temporarily during message sending.
  • Requires proper configuration of credentials in n8n with the necessary cookie and device information.

Troubleshooting

  • Failed to initialize Zalo API. Check your credentials.
    This error indicates invalid or expired cookie credentials. Verify that the cookie, IMEI, and user agent are correct and up to date.

  • Zalo login error: followed by a message
    Indicates issues during authentication. Ensure network connectivity and that the credentials have not been revoked.

  • Zalo API not initialized
    Occurs if the node attempts to send a message before successful login. Check credential validity and node setup.

  • Cannot send typing event
    Happens when sending typing status fails, possibly due to permission or API limitations. Usually non-critical.

  • Attachment handling errors
    If image URLs are invalid or inaccessible, the node may fail to download attachments. Confirm URLs are publicly accessible.

To resolve most issues, verify credentials, ensure internet access, and confirm that all required parameters are correctly provided.

Links and References

Discussion