N8NHow to use Text to Speech in Alohub Node on n8n

How to use Text to Speech in Alohub Node on n8n

Tạ Quốc Thắng·6/9/2026

How to use Text to Speech in Alohub Node on n8n

Detailed guide on how to use the feature Text to Speech (TTS)of Alohub on n8n — make outbound calls and read text content to customers using natural voice.

Requirements:Node has been installed n8n-nodes-alohuband API Key credential has been set up. See Installation guideif not done yet.

Overview

Text to Speech (TTS) is a feature that allows the Alohub system to make outbound calls to customer phone numbers, then automatically read the text contentyou provide in a natural voice. Suitable for scenarios:

  • Sending OTP via voice(Voice OTP) — more secure than SMS

  • Appointment, order, transaction notifications

  • Payment reminders, service renewals

  • Emergency notifications for customers

Node configuration

  1. Drag the Alohubnode into the workflow canvas

  2. Select Credential: Alohub account created

  3. Select Resource: Voice

  4. Select Operation: Text to Speech

  5. Fill in the parameters below

Input parameters

Parameter

Type

Required

Example

Description

Phone Number

string

Yes

0912345678

Phone number receiving the call

Text Content

string

Yes

Mã xác nhận của bạn là 482615

Text content to be read aloud when the call connects

Note:The system automatically generates transactionIda unique identifier for each call for tracking and reconciliation. You do not need to enter it manually.

Tips for writing effective TTS content

  • Concise: 1-2 sentences, under 200 characters to avoid customers hanging up midway

  • Clearly read numbers: separate numbers with spaces — for example 4 8 2 6 1 5instead of 482615to ensure clarity in each digit

  • Avoid special characters: omit emojis, special characters, hard-to-read abbreviations

  • Repeat important information: for OTP, read it twice for customers to take note

API endpoint used

POST https://xapi.alohub.vn/v1/voice/text-to-speech

The node will call this endpoint with the body as follows:

{
  "phone": "0912345678",
  "otp": "Mã xác nhận của bạn là 482615",
  "transactionId": "ah_n8n_a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

Sample response

On success:

{
  "success": true,
  "httpStatus": 200,
  "transactionId": "ah_n8n_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "resource": "voice",
  "operation": "textToSpeech",
  "timestamp": "2026-04-15T09:00:00.000Z",
  "error_code": "SUCCESS",
  "error_message": "SUCCESS"
}

On error:

{
  "success": false,
  "httpStatus": 200,
  "transactionId": "ah_n8n_...",
  "error_code": "0",
  "error_message": "HỆ THỐNG OUTBOUND GẶP SỰ CỐ",
  "errorCode": "0",
  "errorMessage": "HỆ THỐNG OUTBOUND GẶP SỰ CỐ"
}

Example of a real workflow

Workflow 1 — Simple Voice OTP

[Webhook Trigger] → [Code: Generate OTP] → [Alohub: Voice > Text to Speech]
                                              Phone Number: {{ $json.phone }}
                                              Text Content: Mã OTP của bạn là {{ $json.otp }}

Workflow 2 — Appointment reminder from Google Sheets

[Schedule Trigger 8AM] → [Google Sheets: Get Appointments] → [Alohub: Voice > Text to Speech]
                                                                Phone Number: {{ $json.customer_phone }}
                                                                Text Content: Xin chào {{ $json.name }},
                                                                lịch hẹn của bạn lúc {{ $json.time }}
                                                                ngày hôm nay.

Workflow 3 — New order notification

[Webhook: New Order] → [Alohub: Voice > Text to Speech]
                          Phone Number: {{ $json.customer_phone }}
                          Text Content: Đơn hàng số {{ $json.order_id }}
                          đã được xác nhận. Cảm ơn quý khách.

Using with AI Agent

Text to Speech can be used as a tool for AI Agent — AI will generate content and call to read to customers based on the conversation context.

Setup

  1. Drag the When chat message received→ connect to AI Agent

  2. Add Chat Model(OpenAI / Claude / Gemini)

  3. Add Tool: select Alohub Tool

  4. Configure Alohub Tool:

Field

Value

Explanation

Resource

Voice

Operation

Text to Speech

Phone Number

{{ $fromAI('phoneNumber', 'Số điện thoại cần gọi', 'string') }}

AI automatically extracts from the chat message

Text Content

{{ $fromAI('textContent', 'Nội dung cần đọc cho khách hàng', 'string') }}

AI automatically generates appropriate content

Example chat

# Người dùng gõ:
"Gọi cho khách 0912345678 thông báo đơn hàng đã giao thành công"

# AI Agent tự động:
# 1. Nhận diện cần gọi Voice > Text to Speech
# 2. Trích xuất phoneNumber = "0912345678"
# 3. Sinh nội dung: "Xin chào, đơn hàng của quý khách đã được giao thành công."
# 4. Gọi Alohub Tool → thực hiện cuộc gọi + đọc nội dung
# 5. Trả kết quả cho người dùng

Common error handling

Error code

Message

Cause

How to handle

0

Outbound system encountered an issue

The PBX system is temporarily unavailable

Contact Alohub support

401

Authorization failed

Invalid API Key

Check Credential again

400

Bad request

Missing required fields or incorrect format

Check phone, text content

Tip:Enable Continue On Errorin the node's Settings so that the workflow continues to run even if the call fails — the output will contain all error information for processing or retrying later.

Was this article helpful?
Updated: 6/9/2026
để chuyển bài