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

Overview

This node operation "Gửi trạng thái tin nhắn" (Send message status) for the Zalo Send Message resource allows users to send various types of message status updates or events within a Zalo chat thread. It supports sending typing indicators, text messages, video messages, voice messages, and other message-related statuses to either individual users or groups.

Typical use cases include:

  • Indicating that a user is typing in a chat.
  • Sending a text message or multimedia content programmatically.
  • Sending voice or video messages with optional thumbnails.
  • Updating message statuses in automated workflows involving Zalo messaging.

For example, a chatbot could use this node to show typing status before sending a reply, or an automation could send a video message with a generated thumbnail to a group chat.

Properties

Name Meaning
Thread ID The unique identifier of the chat thread where the message status or event will be sent.
Type The type of the message recipient: 0 for User (individual chat), 1 for Group chat.

Output

The node outputs an array of JSON objects, each representing the result of sending a message status or event for an input item. Each output object contains:

  • success: Boolean indicating if the operation was successful.
  • response: The raw response from the Zalo API after sending the status or message.
  • threadId: The ID of the thread where the status/message was sent.
  • threadType: The type of thread (User or Group).
  • Additional fields depending on the message type, such as:
    • messageContent: Details of the message content sent.
    • message: Text message content (for text messages).
    • videoUrl, thumbnailUrl, videoInfo: For video messages.
    • voiceUrl, voiceFile, language, fileSize: For voice messages.
  • In case of failure, an error field with error details is included.

The node does not output binary data directly but handles media files internally (e.g., saving images or generating thumbnails) during processing.

Dependencies

  • Requires valid Zalo API credentials including authentication cookies, device IMEI, and user agent strings.
  • Uses helper utilities for handling media files such as downloading images, generating thumbnails, and cleaning up temporary files.
  • Relies on external modules for interacting with the Zalo API.
  • Node expects proper configuration of credentials in n8n to authenticate API requests.

Troubleshooting

Common Issues

  • Zalo API not initialized: Occurs if the node fails to create a valid Zalo API client instance due to missing or invalid credentials.
  • Failed to download video: Happens when the provided video URL is inaccessible or invalid.
  • Text-to-speech conversion failed: If voice message generation fails, possibly due to invalid voice file or language parameters.
  • Invalid thread ID or type: Sending status to a non-existent or incorrectly typed thread may cause errors.

Error Messages and Resolutions

  • "Zalo API not initialized": Verify that the API credentials are correctly set and valid.
  • "Failed to download video": Check the video URL and network accessibility.
  • "Chuyển đổi text-to-speech thất bại" (Text-to-speech conversion failed): Ensure the voice file and language inputs are correct.
  • Errors related to file handling: Confirm that the node has permission to read/write temporary files and that paths are valid.
  • General API errors: Review the error message returned by the Zalo API and adjust parameters accordingly.

If the node is configured to continue on fail, it will output error details per item instead of stopping execution.

Links and References


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

Discussion