Actions7
- 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 allows users to input text and receive a synthesized audio output in various voice styles and audio formats. The node supports converting text to speech and optionally sending the generated speech as a voice message to a Zalo user or group.
Common scenarios where this node is beneficial include:
- Creating automated voice notifications or alerts from text content.
- Generating audio messages for accessibility purposes.
- Sending personalized voice messages in Zalo chats automatically.
- Integrating TTS functionality into workflows that require audio output from textual data.
Practical example:
- A workflow that takes customer support responses, converts them to speech, and sends them as voice messages to customers on Zalo.
- An automation that reads out news headlines or updates by converting text feeds into audio clips.
Properties
| Name | Meaning |
|---|---|
| Text | The text content to be converted into speech. |
| Voice (Giọng đọc) | The voice style 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 in the output JSON 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," the node sends the generated speech as a voice message to a specified Zalo thread (user or group) and outputs a JSON object confirming success, including:
success: Boolean indicating if the message was sent successfully.message: Confirmation string.response: The raw response from the send voice message API call.threadId: The ID of the recipient thread.threadType: Whether the recipient is a user or group.ttsUrl: The URL of the synthesized audio sent.
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 with cookie, IMEI, and user agent information for authentication.
- Zalo TTS API credentials containing an API key for accessing the text-to-speech service.
- The node makes HTTP POST requests to
https://api.zalo.ai/v1/tts/synthesizefor speech synthesis. - Requires n8n environment configured with these credentials.
- Uses helper functions for HTTP requests and temporary image handling (not relevant for TTS but part of the bundled code).
Troubleshooting
- Failed to initialize Zalo API: Indicates invalid or missing Zalo API credentials. Verify that the cookie, IMEI, and user agent are correctly set.
- Zalo login error: Could be due to expired or incorrect authentication details. Refresh credentials.
- Zalo TTS API credentials are not set or invalid: Ensure the TTS API key credential is created and assigned properly.
- Zalo TTS API error: Returned when the TTS service responds with an error. Check the error message for details, such as invalid parameters or quota limits.
- Failed to get audio URL from Zalo TTS API response: The API did not return a valid audio URL; verify input parameters and API status.
- Network issues or rate limiting may cause HTTP request failures.
- If sending TTS messages fails, confirm the thread ID and type are correct and that the Zalo API client is initialized.
To resolve errors, check credentials, input parameters, and network connectivity. Enable detailed logging to trace issues.
Links and References
- Zalo AI Text To Speech API Documentation
- Zalo Official Developer Portal
- n8n documentation on Creating Custom Nodes