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 enables sending text-to-speech (TTS) messages via the Zalo platform. It converts input text into speech audio using Zalo's TTS API and then sends the generated audio as a voice message to a specified user or group thread on Zalo. This is useful for automating voice notifications, alerts, or personalized audio messages in chat conversations.

Practical examples:

  • Sending automated voice reminders or alerts to users or groups.
  • Converting chatbot responses into speech and delivering them as voice messages.
  • Broadcasting announcements with natural-sounding voices to multiple recipients.

Properties

Name Meaning
Thread ID The ID of the user or group thread to which the TTS voice message will be sent.
Type The type of the thread: either "User" (individual chat) or "Group" (group chat).
Text The text content that will be converted into speech audio.
Voice (Giọng đọc) The voice profile used for speech synthesis. Options include various male/female voices from different Vietnamese regions.
EnCode Output The audio encoding format for the output speech. Options: WAV, MP3, AAC.
Speed Playback speed of the synthesized speech, ranging from 0.8 (slower) to 1.2 (faster).

Output

The node outputs a JSON object containing:

  • success: Boolean indicating if the operation succeeded.
  • message: Confirmation string stating the TTS voice message was sent successfully.
  • response: The raw response from the Zalo API after sending the voice message.
  • threadId: The ID of the thread where the message was sent.
  • threadType: Numeric code representing whether the thread is a user or group.
  • ttsUrl: The URL of the generated speech audio returned by the Zalo TTS API.

No binary data is output directly; instead, the node uses the URL of the synthesized audio to send the voice message.

Dependencies

  • Requires valid credentials for two APIs:
    • A Zalo API credential with cookie, IMEI, and user agent information to authenticate and send messages.
    • A Zalo TTS API credential containing an API key for accessing the text-to-speech service.
  • The node makes HTTP POST requests to https://api.zalo.ai/v1/tts/synthesize for speech synthesis.
  • The Zalo API client library (zca-js) is used internally to interact with Zalo messaging services.

Troubleshooting

  • Zalo login error: If the node fails to initialize the Zalo API client, verify that the provided cookie, IMEI, and user agent credentials are correct and active.
  • Missing or invalid TTS API key: Ensure the Zalo TTS API credential is set up properly with a valid API key.
  • Failed to get audio URL: If the TTS API response does not contain a valid audio URL, check the input text and parameters for correctness.
  • API errors from Zalo TTS: The node surfaces error messages from the TTS API; review these messages to adjust request parameters or credentials.
  • Thread ID or Type issues: Confirm that the target thread ID exists and matches the specified type (user or group).
  • Playback speed out of range: The speed must be between 0.8 and 1.2; values outside this range may cause errors.

Links and References

Discussion