Actions7
- Zalo Send Message Actions
- Zalo Text To Speech Actions
Overview
The Zalo Send Message node enables sending messages through the Zalo platform using its API, authenticated via a cookie-based login. It is particularly useful for automating communication in personal or group chats on Zalo. The node supports sending plain text messages with options to mention users, quote previous messages, and attach images. This makes it suitable for scenarios such as customer support automation, marketing campaigns, or team notifications within Zalo.
For example, you can use this node to:
- Send personalized alerts or reminders to individual users.
- Broadcast announcements to group chats.
- Reply to specific messages by quoting them.
- Highlight important parts of a message by mentioning users.
- Include images as attachments in your messages.
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 | The type of conversation: "Cá nhân" (Personal/User) or "Nhóm" (Group). |
| Nội dung tin nhắn / Message Content | The textual content of the message to send. |
| Độ khẩn cấp / Urgency | The urgency level of the message: "Bình thường / Default", "Quan trọng / Important", or "Khẩn cấp / Urgent". |
| Tùy chọn nâng cao / Advanced Options | Additional message options including mentions, quotes, and image attachments. |
Advanced Options Details
Đề cập người dùng / Mentions
Allows mentioning users inside the message by specifying:- User ID of the mentioned user
- Position of the mention in the message text
- Length of the mention
Trích dẫn tin nhắn / Quote Message
Enables quoting a previous message either by auto-detecting from the previous node's data or manually defining:- Sender UID
- Original message ID
- cliMsgId
- Quoted content
Ảnh đính kèm / Attachments
Supports attaching one or more images by providing their public URLs.
Output
The node outputs an array of JSON objects, each representing the result of sending a message for each input item. The typical output structure 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 value indicating whether the thread is a user (0) or group (1).messageContent: The actual message payload sent, including text, urgency, mentions, quotes, and attachments.
If attachments are included, the node handles temporary saving and removal of images internally; binary data is not directly output but managed during execution.
Example output snippet:
{
"success": true,
"response": { /* Zalo API response object */ },
"threadId": "123456789",
"threadType": 0,
"messageContent": {
"msg": "Hello, this is a test message",
"urgency": 1,
"mentions": [{ "pos": 0, "uid": "987654321", "len": 5 }],
"quote": { "msgId": "111", "uidFrom": "222", "cliMsgId": "333", "content": "Quoted message", "ttl": "0" },
"attachments": ["/tmp/image1.jpg"]
}
}
Dependencies
- Requires valid Zalo API credentials authenticated via a cookie, IMEI, and user agent string.
- Uses the external
zca-jslibrary to interact with the Zalo API. - Utilizes helper functions to save and remove images temporarily when sending attachments.
- For advanced features like mentions and quoting, the node expects structured input data.
- No direct environment variables are required beyond the configured credentials.
Troubleshooting
Failed to initialize Zalo API. Check your credentials.
Indicates invalid or missing Zalo API authentication details. Verify that the cookie, IMEI, and user agent are correctly set in the credentials.Zalo login error: ...
Occurs if the login process to Zalo fails. Check network connectivity and credential validity.Zalo API not initialized
Happens if the node attempts to send a message without successful API client initialization. Ensure credentials are properly loaded before execution.Cannot send typing event
Typing event failures are logged but do not stop message sending. Usually safe to ignore unless typing indicators are critical.Error sending Zalo message: ...
General catch-all for errors during message sending. IfContinue On Failis disabled, the node will throw an error and stop execution. EnableContinue On Failto handle errors gracefully.Invalid or missing sticker details (for other operations)
When sending stickers, ensure the sticker ID is valid and the sticker details contain all required fields.
Links and References
- Zalo Official API Documentation (general reference for Zalo messaging API)
- Zalo Text-to-Speech API (for related TTS operations)
- n8n Documentation (for general node usage and credential setup)
This summary focuses exclusively on the Zalo Send Message resource and the Gửi tin nhắn operation, reflecting the provided properties and source code logic.