API to make an outbound call and play a pre-recorded audio file for the customer to listen to. Suitable for automatic notification situations: appointment reminders, order confirmations, debt reminders, surveys, etc.
Authentication: Request needs to send header
X-Api-Key. Contact Alohub to obtain an API Key.
Requirements: The audio file must be pre-configured in the campaign (
campaignId). If there is no file, contact the technical team to upload the audio file into the campaign before calling the API.
{{base_url}}/v1/voice/play-fileHeader | Required | Description |
|---|---|---|
| Yes | API Key for authentication |
| Yes |
|
Parameter | Type | Required | Description |
|---|---|---|---|
| string | Yes | Customer's phone number |
| number | Yes | Campaign ID (contains the pre-configured audio file) |
| string | No | Transaction ID generated by the client to match results via webhook |
curl --location -g '{{base_url}}/v1/voice/play-file' \
--header 'X-Api-Key: {{api_key}}' \
--header 'Content-Type: application/json' \
--data '{
"phone": "0123456789",
"campaignId": 1,
"transactionId": "TXN_002"
}'const axios = require('axios')
const response = await axios.post('{{base_url}}/v1/voice/play-file', {
phone: '0123456789',
campaignId: 1,
transactionId: 'TXN_002'
}, {
headers: {
'X-Api-Key': '{{api_key}}',
'Content-Type': 'application/json'
}
})
console.log(response.data)import requests
response = requests.post('{{base_url}}/v1/voice/play-file',
json={
'phone': '0123456789',
'campaignId': 1,
'transactionId': 'TXN_002'
},
headers={
'X-Api-Key': '{{api_key}}',
'Content-Type': 'application/json'
}
)
print(response.json())Compare with Text-to-Speech: Use Audio Playback when the content is fixed and requires good voice quality (pre-recorded). Use Text-to-Speech when the content is dynamic (OTP code, amount, customer name, etc.) that cannot be pre-recorded.