Actions8
- Zalo Send Message Actions
- Zalo Text To Speech Actions
Overview
This node integrates with the Zalo platform to convert text into speech using Zalo's Text-to-Speech (TTS) API. It supports converting input text into an audio file in various formats and voices, and optionally sending the generated speech as a voice message to a Zalo user or group.
Common scenarios where this node is beneficial include:
- Automating voice notifications or alerts by converting dynamic text content into speech.
- Creating audio messages for accessibility purposes or personalized communication.
- Integrating TTS functionality into workflows that require sending voice messages on Zalo.
Practical example:
- A workflow that takes customer support responses, converts them into speech, and sends them as voice messages to customers via Zalo.
Properties
| Name | Meaning |
|---|---|
| Text | The text content to be converted into speech. |
| Voice (Giọng đọc) | The voice profile used for speech synthesis. Options: - Phụ nữ miền Nam 1 - Phụ nữ miền Bắc 1 - Đàn ông miền Nam - Đàn ông miền Bắc - Phụ nữ miền Bắc 2 - Phụ nữ miền Nam 2 |
| EnCode Output | The audio encoding format of the output. Options: WAV, MP3, AAC |
| Speed | Playback speed of the synthesized speech, ranging from 0.8 (slower) to 1.2 (faster). |
Output
The node outputs JSON data containing the response from the Zalo TTS API. The key fields include:
data.url: The URL of the generated audio file containing the synthesized speech.- Other metadata returned by the API such as error codes and messages if any.
If the operation is "Convert Text to Speech", the output JSON contains the direct API response including the audio URL.
If the operation is "Send TTS Message", after converting the text to speech, the node sends the audio as a voice message to a specified Zalo thread (user or group). The output JSON includes:
success: Boolean indicating if the message was sent successfully.message: Confirmation string.response: The response object from the Zalo API for sending the voice message.threadId: The ID of the recipient thread.threadType: Indicates whether the recipient is a user or group.ttsUrl: The URL of the synthesized audio used in the message.
The node does not output binary data directly but provides URLs to the audio files.
Dependencies
Requires valid credentials for two APIs:
- Zalo API credentials (including cookie, IMEI, and user agent) for sending messages.
- Zalo TTS API credentials containing an API key for accessing the text-to-speech service.
The node makes HTTP POST requests to the Zalo TTS API endpoint at
https://api.zalo.ai/v1/tts/synthesize.Proper configuration of these credentials within n8n is necessary for the node to function.
Troubleshooting
Zalo login error: If the node fails to initialize the Zalo API client, verify that the Zalo API credentials are correctly set and valid (cookie, IMEI, user agent).
Zalo TTS API credentials missing or invalid: The node throws an error if the TTS API key credential is not configured or invalid. Ensure the API key is correctly created and assigned.
API errors from Zalo TTS: If the API returns an error or non-zero error code, the node surfaces the error message. Check the input parameters (text length, voice ID, encoding type) and API key validity.
Failed to get audio URL: When sending TTS messages, if the audio URL is missing in the API response, the node will throw an error. This may indicate an issue with the TTS service or request parameters.
Network or HTTP errors: Ensure network connectivity and that the Zalo API endpoints are reachable.
Invalid voice or encoding options: Use only the supported voice IDs and encoding types as listed in the properties.
Links and References
- Zalo AI Text-to-Speech API Documentation
- Zalo Official Website
- n8n Documentation on Creating Custom Nodes