Voice OTP Broadcast
POST /api/broadcasts/otp
Send OTP (One-Time Password) voice messages to a single phone number. The voice must contain at least one dynamic part with digit mode to read the OTP code.
Request Parameters
Section titled “Request Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| request_id | string | Yes | Unique request identifier (16-64 chars) to prevent duplicate requests. Use UUID or random string. |
| voice | string | Yes | Name of your approved voice with digit mode |
| sender | string | Yes | Your active caller sender number |
| phone_number | string | Yes | Single Bangladeshi phone number (01XXXXXXXXX format) |
| otp_code | string | Yes | OTP code (4-6 digits) |
Request Example
Section titled “Request Example”curl -X POST https://api.awajdigital.com/api/broadcasts/otp \ -H "Authorization: Bearer your_api_token_here" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "request_id": "unique_request_id_123", "voice": "your_voice_name", "sender": "8801234567890", "phone_number": "019XXXXXXXX", "otp_code": "1234" }'// Browser JavaScript (Fetch API)const response = await fetch('https://api.awajdigital.com/api/broadcasts/otp', { method: 'POST', headers: { 'Authorization': 'Bearer your_api_token_here', 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify({ request_id: 'unique_request_id_123', voice: 'your_voice_name', sender: '8801234567890', phone_number: '019XXXXXXXX', otp_code: '1234' })});
const data = await response.json();console.log(data);// Node.js with axiosconst axios = require('axios');
async function sendOtpBroadcast() { try { const response = await axios.post('https://api.awajdigital.com/api/broadcasts/otp', { request_id: 'unique_request_id_123', voice: 'your_voice_name', sender: '8801234567890', phone_number: '019XXXXXXXX', otp_code: '1234' }, { headers: { 'Authorization': 'Bearer your_api_token_here', 'Accept': 'application/json', 'Content-Type': 'application/json' } });
console.log(response.data); } catch (error) { console.error('Error:', error.response?.data || error.message); }}
sendOtpBroadcast();# Python with requestsimport requests
def send_otp_broadcast(): url = 'https://api.awajdigital.com/api/broadcasts/otp' headers = { 'Authorization': 'Bearer your_api_token_here', 'Accept': 'application/json', 'Content-Type': 'application/json' } data = { 'request_id': 'unique_request_id_123', 'voice': 'your_voice_name', 'sender': '8801234567890', 'phone_number': '019XXXXXXXX', 'otp_code': '1234' }
try: response = requests.post(url, json=data, headers=headers) print(response.json()) except requests.exceptions.RequestException as e: print(f'Error: {e}')
send_otp_broadcast()<?php// PHP with cURL$url = 'https://api.awajdigital.com/api/broadcasts/otp';$token = 'your_api_token_here';
$data = [ 'request_id' => 'unique_request_id_123', 'voice' => 'your_voice_name', 'sender' => '8801234567890', 'phone_number' => '019XXXXXXXX', 'otp_code' => '1234'];
$ch = curl_init($url);curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $token, 'Accept: application/json', 'Content-Type: application/json']);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);curl_close($ch);
$result = json_decode($response, true);print_r($result);?>Success Response Example
Section titled “Success Response Example”{ "success": true, "broadcast": { "id": 123, "name": "otp_api_1_your_voice_019XXXXXXXX", "status": "broadcasting", "createdAt": "2025-12-29T10:30:00.000Z" }}