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

The Zalo Send Message node enables sending messages through the Zalo platform using its API, authenticated via a cookie-based login. It is designed to send text messages to individual users or groups within Zalo conversations. The node supports advanced messaging features such as mentioning users, quoting previous messages, and attaching images.

This node is beneficial in scenarios where automated communication with Zalo users or groups is required, such as customer support notifications, marketing campaigns, or internal team alerts. For example, a business could automatically send order updates to customers or broadcast announcements to group chats.

Properties

Name Meaning
ID cuộc trò chuyện / Thread ID The unique identifier of the conversation (user or group) where the message will be sent. Required.
Loại cuộc trò chuyện The type of conversation: either "Cá nhân" (Individual user) or "Nhóm" (Group). Options: 0 (Individual), 1 (Group).
Nội dung tin nhắn / Message Content The textual content of the message to send. Required.
Độ khẩn cấp / Urgency The urgency level of the message. Options: 0 (Bình thường / Default), 1 (Quan trọng / Important), 2 (Khẩn cấp / Urgent).
Tùy chọn nâng cao / Advanced Options Collection of advanced options including:
- Đề cập người dùng / Mentions: Specify users to mention by their user ID, position, and length in the message.
- Trích dẫn tin nhắn / Quote Message: Quote a previous message either auto-detected from input data or manually defined.
- Ảnh đính kèm / Attachments: Attach one or more images by providing public URLs.

Output

The node outputs an array of JSON objects, each corresponding to an input item processed. For the "Gửi tin nhắn" operation, the output JSON includes:

  • success: Boolean indicating if the message was sent successfully.
  • response: The raw response object returned by the Zalo API after sending the message.
  • threadId: The ID of the conversation where the message was sent.
  • threadType: Numeric code representing the conversation type (0 for user, 1 for group).
  • messageContent: The message payload that was sent, including text, urgency, mentions, quotes, and attachments if any.

If attachments are included, the node handles temporary downloading and cleanup of image files internally; these binary data details are abstracted away from the output.

Dependencies

  • Requires valid Zalo API credentials authenticated via a cookie, IMEI, and user agent string.
  • Uses the external zca-js library to interact with the Zalo API.
  • For image attachments, it downloads images from provided URLs temporarily during message sending.
  • No additional environment variables are explicitly required beyond the configured Zalo API credential.

Troubleshooting

  • Failed to initialize Zalo API. Check your credentials.
    This error indicates invalid or missing Zalo API authentication details. Ensure the cookie, IMEI, and user agent are correctly set in the credentials.

  • Zalo login error: followed by a message
    Indicates failure during login to Zalo API. Verify network connectivity and validity of credentials.

  • Zalo API not initialized
    Occurs if the node attempts to send messages without successful API client initialization. Check credential setup.

  • Invalid reaction (if using reactions)
    Means the specified reaction emoji or type is not recognized. Use only supported reaction values.

  • Zalo TTS API credentials are not set or invalid (for TTS operations)
    The Text-to-Speech API key is missing or incorrect. Configure the appropriate API key credential.

  • Failed to get audio URL from Zalo TTS API response
    The TTS service did not return a usable audio URL. Check the input text and API response.

  • Cannot send typing event (logged as warning)
    Sending typing indicators may fail silently; this does not block message sending but indicates possible connection issues.

To resolve most errors, verify all credentials, ensure correct property values, and confirm network access to Zalo services.

Links and References

Discussion