Zalo Message Trigger icon

Zalo Message Trigger

Lắng nghe tin nhắn Zalo real-time - Hỗ trợ nhiều tài khoản và lọc theo loại tin nhắn

Overview

This node is a trigger designed to listen for incoming messages on the Zalo platform, a popular messaging app. It can monitor both user-to-user messages and group messages in real-time. When a message event occurs, the node captures the message data and optionally enriches it with detailed sender information.

Common scenarios where this node is beneficial include:

  • Automating responses or workflows based on incoming Zalo messages.
  • Monitoring conversations in groups or direct chats for specific keywords or commands.
  • Collecting message data for analytics or logging purposes.
  • Integrating Zalo messaging events into broader automation pipelines.

Practical example:

  • A business wants to automatically respond to customer inquiries sent via Zalo. This node triggers when a user sends a message, allowing subsequent workflow steps to process and reply accordingly.
  • A community manager wants to track all group messages mentioning certain topics and log them for review.

Properties

Name Meaning
Event Types Types of messages to listen for: "User Messages" (direct messages), "Group Messages" (group chats), or both.
Self Listen Whether to listen to messages sent by the bot itself. Enables filtering out self-sent messages.
User Identifier A unique identifier string to distinguish this user instance within the workflow (e.g., "user1", "user2").
Lấy thông tin người dùng (Get User Info) Whether to automatically fetch detailed information about the message sender to include in the output.

Output

The node outputs an array of JSON objects representing received messages. Each message object includes:

  • The original message data from Zalo.
  • Metadata fields such as:
    • _timestamp: The timestamp when the message was processed.
    • _instanceKey: Unique key identifying the Zalo connection instance.
    • _credentialId: Identifier of the API credential used.
    • _userIdentifier: The configured user identifier property.
    • _eventType: The type of event/message received.
    • _source: Fixed string "zalo_message" indicating the source of the event.

If the "Get User Info" option is enabled, each message may also include enriched sender details fetched from the Zalo API under a dedicated field.

No binary data output is indicated by the code; all outputs are JSON-formatted message objects.

Dependencies

  • Requires an API key credential for authenticating with the Zalo API.
  • Uses the zaloApi credential to login and listen for messages.
  • Relies on a webhook URL configured in n8n to receive real-time message events.
  • Uses internal Zalo client libraries bundled with the node for managing connections and fetching user info.
  • Node requires proper configuration of webhook endpoint and credentials in n8n.

Troubleshooting

  • Connection failures: Errors during login or connection setup to Zalo will throw errors like "Zalo connection failed". Ensure that the API credentials are valid and have necessary permissions.
  • Webhook issues: If the webhook URL is not reachable or misconfigured, messages will not be received. Verify that the webhook path is correctly set and accessible.
  • Message filtering: If no messages appear, check that the selected event types match the expected message sources and that "Self Listen" is configured appropriately.
  • User info retrieval errors: Enabling "Get User Info" may cause errors if the API call to fetch sender details fails. These errors are logged, and the message will contain an error field instead of user info.
  • Queue buildup: The node internally queues messages if webhook triggering fails temporarily. Large queue sizes might indicate webhook delivery problems.

Links and References


This summary is based solely on static analysis of the provided source code and input property definitions.

Discussion