N8NHow to use Play Audio in Alohub Node on n8n

How to use Play Audio in Alohub Node on n8n

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

How to use Play Audio in Alohub Node on n8n

Detailed guide on how to use the Play Audiofeature of Alohub on n8n — make outbound calls and play pre-recorded audio files (MP3, WAV, M4A) to customers.

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

Overview

Play Audio allows Alohub to make outbound calls and play available audio filesto customers. Unlike Text to Speech (synthesized voice), Play Audio uses real audio files provided by you— suitable when you need to:

  • Play professionally recorded advertising messagesPlay

  • jingles, brand hold musicPlay announcements in

  • real human voice, with more natural emotion than TTSPlay

  • Phát multilingual content(English, Chinese, Korean...) when TTS is not supported

Supported file formats

Format

Extension

Recommendation

MP3

.mp3

Common, small size — recommended

WAV

.wav

High quality, large size

M4A

.m4a

Apple format, good for files recorded from iPhone

Node configuration

  1. Drag the Alohubnode into the workflow canvas

  2. Select Credential: Alohub account created

  3. Select Resource: Voice

  4. Select Operation: Play Audio

  5. Select Audio Source: how to obtain the audio file (URL or Binary Data)

Input parameters

Parameter

Type

Required

Example

Description

Phone Number

string

Yes

0912345678

Phone number receiving the call

Audio Source

enum

Yes

URL/ Binary Data

How to provide the audio file

Audio URL

string

If URL is selected

https://example.com/audio.mp3

Direct link to the audio file

Binary Property

string

If Binary is selected

data

Name of the binary property from the previous node

Two ways to provide the audio file

Suitable when you have uploaded the file to a location with a public link (CDN, S3, Google Drive public...). The node will automatically download the file and send it to Alohub.

Tip:This is the most stable way— the file is sent intact, avoiding audio distortion due to encode/decode when passing through multiple nodes.

With Google Drive: get the file share link, then convert it to a direct download link:

# Link share gốc:
https://drive.google.com/file/d/FILE_ID/view?usp=sharing

# Đổi thành link download trực tiếp:
https://drive.google.com/uc?export=download&id=FILE_ID

Method 2 — Audio Source: Binary Data

Suitable when the file comes from another node in the workflow (Google Drive node, HTTP Request, Read Binary File, Email Attachment...).

Configuration:

  • Field Binary Property: enter the name of the property containing the binary file (usually data— the default name of n8n)

  • The previous node must output binary data in the same named property

Note:Some WAV files may be altered when passing through n8n's binary pipeline. If you encounter audio distortion, switch to Audio Source: URLor change to an MP3 file.

API endpoint used

POST https://xapi.alohub.vn/v1/voice/tts/audio

The node sends a request in multipart/form-datawith 2 fields:

Field

Type

Description

phone

text

Receiving phone number

file

file

Audio file (MP3/WAV/M4A)

Sample response

On success:

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

On error:

{
  "success": false,
  "httpStatus": 400,
  "transactionId": "ah_n8n_...",
  "error_code": "0",
  "error_message": "File audio không hợp lệ",
  "errorCode": "0",
  "errorMessage": "File audio không hợp lệ"
}

Example real workflow

[Manual Trigger] → [Alohub: Voice > Play Audio]
                     Phone Number: 0912345678
                     Audio Source: URL
                     Audio URL: https://cdn.alohub.vn/audio/promo.mp3

Workflow 2 — Play file from Google Drive

[Schedule Trigger] → [Google Drive: Download File] → [Alohub: Voice > Play Audio]
                                                       Phone Number: 0912345678
                                                       Audio Source: Binary Data
                                                       Binary Property: data

Workflow 3 — Send bulk reminders

[Schedule Trigger 9AM] → [Database: Get Overdue Customers] → [Loop: For Each] → [Alohub: Voice > Play Audio]
                                                                                  Phone Number: {{ $json.phone }}
                                                                                  Audio Source: URL
                                                                                  Audio URL: https://cdn.alohub.vn/audio/payment-reminder.mp3

Workflow 4 — Send voice message from email attachment

[Email Trigger] → [Extract Attachment (MP3)] → [Alohub: Voice > Play Audio]
                                                  Phone Number: {{ $json.recipient_phone }}
                                                  Audio Source: Binary Data
                                                  Binary Property: attachment_0

Using with AI Agent

Play Audio can be used as a tool for AI Agent — suitable for scenarios where AI selects the appropriate audio file based on the conversation content with customers.

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

Play Audio

Phone Number

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

AI extracts the phone number automatically

Audio Source

URL

Fixed as URL

Audio URL

{{ $fromAI('audioUrl', 'Link file audio phù hợp với ngữ cảnh', 'string') }}

AI selects the appropriate file from the library

Example chat

# Người dùng gõ:
"Gọi cho khách 0912345678 phát thông báo khuyến mãi"

# AI Agent tự động:
# 1. Nhận diện cần gọi Voice > Play Audio
# 2. Trích xuất phoneNumber = "0912345678"
# 3. Chọn URL file: https://cdn.alohub.vn/audio/promo.mp3
# 4. Gọi Alohub Tool → thực hiện cuộc gọi + phát file
# 5. Trả kết quả cho người dùng

Common error handling

Error code

Message

Cause

How to handle

400

Required request part 'file' is not present

File not uploaded to the API

Check Binary Property name or URL

401

Authorization failed

Invalid API Key

Check Credential again

Audio file has distortion

WAV through binary pipeline has altered encoding

Switch to Audio Source: URL or change to MP3

Unable to download file from URL

URL is not a direct download link

Ensure the URL returns a binary file, not HTML

Recommendation:Host audio files on your CDN or object storage service (AWS S3, Cloudflare R2, Bunny CDN) to ensure the highest speed and stability.

Comparison of Play Audio vs Text to Speech

Criteria

Play Audio

Text to Speech

Voice quality

Natural (real human voice)

Synthesized (machine reading)

Personalization

Cannot insert dynamic data

Can insert name, amount, OTP...

Preparation cost

Requires effort to record in advance

Just need to write text

Suitable for

Advertising, jingles, fixed content

OTP, personalized announcements

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