Zalo Send Message icon

Zalo Send Message

Gửi tin nhắn Zalo với hỗ trợ text, ảnh, file đính kèm, mention, HTML và Style codes [b]text[/b]

Overview

This node sends messages via the Zalo messaging platform to either individual users or groups. It supports sending plain text or HTML-formatted messages, with optional styling codes for bold, italic, color, and font size. Users can attach multiple files by providing URLs, specify message urgency levels, and set a time-to-live (TTL) for the message.

Common scenarios include:

  • Automating notifications or alerts to specific users or groups on Zalo.
  • Sending styled marketing messages or announcements.
  • Sharing multiple attachments such as images, documents, or videos alongside text messages.

Example: Sending an urgent HTML message with embedded styles and multiple image attachments to a group chat.

Properties

Name Meaning
Thread ID The ID of the thread to send the message to — can be a User ID or Group ID.
Type The type of message recipient: User (0) or Group (1).
Message The content of the message to send; supports plain text, HTML, or style codes like [b]bold[/b].
Message Format Format of the message content: Plain Text or HTML (Auto Convert).
Urgency Urgency level of the message: Default (0), Important (1), or Urgent (2).
TTL (Time To Live) Duration in seconds that the message should exist before expiring; 0 means permanent.
Multiple URLs (Comma Separated) Comma-separated list of public URLs for attachments (images, documents, videos).
Attachments One or more attachments specified as URLs; currently supports only URL type attachments.

Output

The node outputs JSON objects for each input item processed, containing:

  • 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 the message was sent to.
  • threadType: The type of thread (User or Group).
  • messageContent: The final message object sent, including text, styles, urgency, TTL, and attachments if any.
  • error: If sending failed, contains the error message.

If attachments are included, the node downloads them temporarily to send and then removes the temporary files after sending.

Dependencies

  • Requires an API key credential for authenticating with the Zalo API.
  • Uses internal helper functions to download files from URLs for attachments.
  • Relies on a Zalo client library instance initialized with user cookie, IMEI, and user agent parameters.
  • The node expects these authentication details to be provided via credentials configured in n8n.

Troubleshooting

  • Failed to initialize Zalo client: Usually caused by invalid or expired authentication credentials. Recheck and update the API key or cookie credentials.
  • Failed to download file from URL: Occurs if attachment URLs are invalid or inaccessible. Verify URLs are publicly accessible and correct.
  • Cannot send typing event: This is logged as a warning but does not block message sending.
  • NodeOperationError with message content: Happens if message formatting or styles parsing fails. Ensure message format matches selected option and style codes are valid.
  • Timeouts or network errors: Check network connectivity and Zalo API availability.

Links and References

Discussion