Zalo User Interact icon

Zalo User Interact

Gửi tin nhắn và tương tác với Zalo User

Overview

This node enables sending messages to Zalo users or groups. It supports sending text messages with optional attachments, styled text segments, mentions of other users, quoted messages, and message lifetime settings. The node is useful for automating communication workflows on the Zalo platform, such as customer support notifications, group announcements, or personalized messaging campaigns.

Practical examples include:

  • Sending a text message with bold and colored styles to a user.
  • Sending a message with image attachments to a group chat.
  • Mentioning specific users within a message to draw their attention.
  • Quoting a previous message in a reply.
  • Setting message urgency levels like Important or Urgent.

Properties

Name Meaning
User/Group Id ID of the Zalo user or group to send the message to.
Message Content of the message to be sent.
Thread Type Type of conversation: "User" (0) or "Group" (1).
Attachments Collection of file paths to attach to the message. Each attachment requires a path string, e.g., /files/example.txt or https://example.com/image.png.
Attachments (URLs) Comma-separated list of URLs or file paths for attachments, e.g., /files/example.txt,https://example.com/image.png.
Styles Collection of style objects specifying text styles and colors applied to parts of the message. Styles include options like Bold, Italic, Underline, StrikeThrough, Red, Orange, Yellow, Green, Small font, Big font, Lists, Indent. Each style specifies start index and length.
Urgency Priority level of the message: Default (0), Important (1), or Urgent (2).
Mentions Collection of mention objects specifying user mentions inside the message. Each mention includes position (start index), user ID, and length of the mention text.
Quote Message JSON object representing a quoted message to include in the sent message.
Message Lifetime Time-to-live (TTL) for the message in seconds; how long the message should exist before expiring.

Output

The node outputs an array of results corresponding to each input item processed. Each result contains a json field with details about the sent message, including:

  • Confirmation of successful sending.
  • Metadata about the message such as IDs, timestamps, and status.
  • If attachments were included, information about them.
  • Any returned data from the Zalo API related to the message.

If binary data is involved (e.g., attachments), it is handled appropriately but not detailed here.

Dependencies

  • Requires an active connection to the Zalo API.
  • Needs valid API authentication credentials configured in n8n (an API key or token).
  • Uses Node.js modules for HTTP requests and file system access to handle attachments.
  • May require internet access if attachments are specified via URLs.

Troubleshooting

  • Invalid User/Group ID: Ensure the User/Group Id is correct and corresponds to an existing Zalo user or group.
  • Attachment Errors: Verify that attachment paths or URLs are accessible and correctly formatted.
  • API Authentication Failures: Confirm that the API credentials are valid and have necessary permissions.
  • Message Content Issues: Empty messages or invalid JSON in quote messages may cause errors.
  • Rate Limits: Sending too many messages in a short time may trigger rate limiting by Zalo API.
  • Error Messages: The node logs error details including error messages and stack traces. Review these logs to identify issues.
  • Timeouts or Network Errors: Check network connectivity and retry if transient errors occur.

Links and References


Note: Internal credential names and implementation details have been omitted for security and clarity.

Discussion