Zalo Message Trigger icon

Zalo Message Trigger

Sự kiện lắng nghe tin nhắn trên Zalo

Overview

This node acts as a trigger for incoming messages on the Zalo platform, a popular messaging app. It listens for specific types of messages—either from individual users or groups—and can optionally process voice messages by converting them to text using Wit.ai's voice recognition service.

Common scenarios where this node is useful include:

  • Automating responses or workflows based on user or group chat messages.
  • Monitoring conversations in real-time for keywords or commands.
  • Transcribing voice messages into text to enable further automated processing or analysis.

For example, a business could use this node to listen for customer inquiries sent via Zalo and automatically create support tickets or send predefined replies. Another use case is transcribing voice notes from customers to text for sentiment analysis or record keeping.

Properties

Name Meaning
Event Types Types of messages to listen for: "User Messages" (messages from individual users), "Group Messages" (messages from groups). Multiple selections allowed.
Self Listen Whether to allow listening to messages sent by yourself (boolean).
Enable Voice Recognition Whether to enable voice-to-text recognition for voice messages using Wit.ai (boolean).
Voice Processing Mode Mode for processing voice messages: "Tự động nhận diện ngôn ngữ" (automatic language detection) or "Chọn thủ công" (manual selection). Shown only if voice recognition is enabled.
Manual Language Selection If manual mode is selected, choose the language for voice processing: Vietnamese, English, Chinese, Japanese. Only shown if voice recognition is enabled and manual mode is selected.
Wit.ai Credentials Required Notice indicating that Wit.ai credentials are required when voice recognition is enabled.

Output

The node outputs JSON data representing the received message event. The structure includes:

  • message: The original message object received from Zalo.
  • isVoiceMessage: Boolean indicating if the message is a voice message.
  • voiceProcessing (optional): Present if voice recognition is enabled and the message is a voice message. Contains:
    • voiceToText: Array of recognized text strings from the voice message.
    • audioFileName: The filename of the saved audio file.
    • audioFilePath: The path to the saved audio file.
    • processingError: Any error message encountered during voice processing.
    • processingSkipped: Boolean indicating if processing was skipped.
    • skipReason: Reason why processing was skipped.
    • detectedLanguage: Language detected in the voice message.
    • confidence: Confidence score of the voice recognition.

If the node processes voice messages, it saves the audio locally and attempts transcription, enriching the output with these details.

Dependencies

  • Zalo API: Requires authentication via an API key credential to connect and listen to messages.
  • Wit.ai: Optional dependency for voice-to-text conversion. When voice recognition is enabled, valid Wit.ai credentials must be provided.
  • Local environment: The node saves audio files locally for voice messages; appropriate file system permissions are needed.

Troubleshooting

  • Missing Credentials: If the Zalo API credential is not set or invalid, the node will throw an error indicating failure to create the API instance. Ensure the API key is correctly configured.
  • Wit.ai Credential Issues: When voice recognition is enabled but Wit.ai credentials are missing or incomplete, the node throws an error specifying the missing language-specific token. Verify that all required Wit.ai tokens for selected languages are provided.
  • Voice Processing Failures: Errors during voice message transcription are logged and included in the output under processingError. Common causes include unsupported audio formats or network issues with Wit.ai. Check logs for detailed error messages.
  • Self Listen Disabled: If self-listen is false, messages sent by the authenticated user are ignored. This might cause confusion if testing with your own account.
  • Webhook Setup: The node uses webhooks internally to receive events. Ensure that the webhook URL is accessible and properly configured in your n8n instance.

Links and References


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

Discussion