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, optionally with advanced features such as mentions, quoted messages, and image attachments, to individual users or groups on Zalo.

This node is beneficial in scenarios where automated communication is needed within Zalo conversations, such as customer support bots, notification systems, or marketing campaigns. For example, a business can automatically send order updates or promotional messages directly to customers' Zalo 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.
Loại cuộc trò chuyện Type of conversation: either "Cá nhân" (Personal/User) or "Nhóm" (Group).
Nội dung tin nhắn / Message Content The actual text content of the message to be sent.
Độ khẩn cấp / Urgency The urgency level of the message; options are "Bình thường / Default", "Quan trọng / Important", and "Khẩn cấp / Urgent".
Tùy chọn nâng cao / Advanced Options Collection of optional advanced settings including:
- Đề cập người dùng / Mentions Allows mentioning specific users in the message by specifying their user IDs, position, and length of mention.
- Trích dẫn tin nhắn / Quote Message Enables quoting a previous message either automatically from the previous node's data or manually defined.
- Ảnh đính kèm / Attachments One or more images to attach to the message, specified by public URLs.

Output

The node outputs JSON objects for each 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 from the Zalo API after sending the message.
  • threadId: The ID of the conversation where the message was sent.
  • threadType: Numeric type indicating whether the thread is a user (0) or group (1).
  • messageContent: The message payload that was sent, including text, urgency, mentions, quotes, and attachments if any.

If an error occurs and the node is set to continue on failure, the output JSON will contain:

  • success: false
  • error: The error message describing what went wrong.

No binary data output is produced by this operation.

Dependencies

  • Requires valid Zalo API credentials authenticated via a cookie, IMEI, and user agent string.
  • Uses the Zalo API client library (zca-js) to interact with Zalo services.
  • Requires helper utilities for handling image downloads and cleanup.
  • The node expects the Zalo API credentials to be configured properly in n8n with the necessary cookie and device information.

Troubleshooting

  • Failed to initialize Zalo API: Indicates invalid or missing credentials. Verify that the cookie, IMEI, and user agent are correctly set in the credentials.
  • Voice URL is required: When sending voice messages, ensure the voice URL parameter is provided.
  • Invalid reaction: If adding reactions, make sure the reaction value is one of the supported types.
  • Cannot send typing event: This is logged but does not stop execution; it may indicate temporary API limitations or connectivity issues.
  • Zalo TTS API errors: For Text-to-Speech operations, check that the API key credential is set and valid.
  • If the node throws errors on message sending, verify all required parameters (thread ID, message content, etc.) are correctly provided and formatted.

Links and References


This summary covers the "Gửi tin nhắn" operation of the "Zalo Send Message" node, detailing its inputs, outputs, dependencies, and common troubleshooting points based on static analysis of the source code and provided property definitions.

Discussion