Commercial Call - API
Endpoint
The journey to seamless marketing starts here:
https://api.betatel.com/api/v1/callgen/call/commercial
Method: POST
This endpoint initiates commercial calls, enabling the delivery of pre-crafted marketing messages through a one-way communication channel. The AI agent speaks your message clearly and professionally, ensuring your promotions reach customers effortlessly.
Headers
Proper configuration of headers is key to ensuring secure and successful communication. Here’s what you’ll need:
Param | Value | Description |
---|---|---|
Content-type | application/json | Specifies the format of your payload. |
x-api-key | {{x-api-key}} | Your unique API key for secure access. |
x-user-id | {{x-user-id}} | Your user identifier for added security and tracking. |
Request Body
The request body is where you define the details of the commercial call—who receives the message, what the message says, and how it should be delivered.
{
"callee": "38722222222",
"caller": "38111111111",
"text":"Hello! This is an exclusive offer just for you from [Your Brand Name]. Enjoy 20% off your next purchase when you shop with us before 23.02. Don’t miss out on this limited-time deal! Visit our website or nearest store today to take advantage of this special discount. Thank you for being a valued customer!",
"language":"en",
"maxRingTime": 10
}
Field | Type | Required | Description |
---|---|---|---|
text | string | Yes | The message content to deliver to your customer. |
callee | string | Yes | The recipient’s phone number in international format. |
caller | string | Yes | The verification code to send (visible as the caller ID during the flash call). |
maxRingTime | integer | No | Maximum duration for the call to ring, in seconds (default: 5). |
language | string | No | Language of the message (default: en). |
Code Snippets
Integrating the Commercial Call API into your system is simple. Below are examples for various programming languages.
- cUrl
- Python
- Node.js
- PHP
- Java
- C#
curl --location 'https://dev.api.betatel.com/api/v1/callgen/call/commercial' \
--header 'x-api-key: 5326eed0b6f7a83a5bb08e8f5a5e6510a74eff7596736fdc80f09c7242a16f42' \
--header 'x-user-id: 675aed6103dee9ca55a36a9a' \
--header 'Content-Type: application/json' \
--data '{
"callee": "38722222222",
"caller": "38111111111",
"text":"Hello! This is an exclusive offer just for you from [Your Brand Name]. Enjoy 20% off your next purchase when you shop with us before 23.02. Don’t miss out on this limited-time deal! Visit our website or nearest store today to take advantage of this special discount. Thank you for being a valued customer!",
"language":"en",
"maxRingTime": 10
}'
import http.client
import json
conn = http.client.HTTPSConnection("dev.api.betatel.com")
payload = json.dumps({
"callee": "38722222222",
"caller": "38111111111",
"text": "Hello! This is an exclusive offer just for you from [Your Brand Name]. Enjoy 20% off your next purchase when you shop with us before 23.02. Don’t miss out on this limited-time deal! Visit our website or nearest store today to take advantage of this special discount. Thank you for being a valued customer!",
"language": "en",
"maxRingTime": 10
})
headers = {
'x-api-key': '5326eed0b6f7a83a5bb08e8f5a5e6510a74eff7596736fdc80f09c7242a16f42',
'x-user-id': '675aed6103dee9ca55a36a9a',
'Content-Type': 'application/json'
}
conn.request("POST", "/api/v1/callgen/call/commercial", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const axios = require('axios');
let data = JSON.stringify({
"callee": "38722222222",
"caller": "38111111111",
"text": "Hello! This is an exclusive offer just for you from [Your Brand Name]. Enjoy 20% off your next purchase when you shop with us before 23.02. Don’t miss out on this limited-time deal! Visit our website or nearest store today to take advantage of this special discount. Thank you for being a valued customer!",
"language": "en",
"maxRingTime": 10
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://dev.api.betatel.com/api/v1/callgen/call/commercial',
headers: {
'x-api-key': '5326eed0b6f7a83a5bb08e8f5a5e6510a74eff7596736fdc80f09c7242a16f42',
'x-user-id': '675aed6103dee9ca55a36a9a',
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://dev.api.betatel.com/api/v1/callgen/call/commercial',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"callee": "38722222222",
"caller": "38111111111",
"text":"Hello! This is an exclusive offer just for you from [Your Brand Name]. Enjoy 20% off your next purchase when you shop with us before 23.02. Don’t miss out on this limited-time deal! Visit our website or nearest store today to take advantage of this special discount. Thank you for being a valued customer!",
"language":"en",
"maxRingTime": 10
}',
CURLOPT_HTTPHEADER => array(
'x-api-key: 5326eed0b6f7a83a5bb08e8f5a5e6510a74eff7596736fdc80f09c7242a16f42',
'x-user-id: 675aed6103dee9ca55a36a9a',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://dev.api.betatel.com/api/v1/callgen/call/commercial")
.header("x-api-key", "5326eed0b6f7a83a5bb08e8f5a5e6510a74eff7596736fdc80f09c7242a16f42")
.header("x-user-id", "675aed6103dee9ca55a36a9a")
.header("Content-Type", "application/json")
.body("{\n \"callee\": \"38722222222\",\n \"caller\": \"38111111111\",\n \"text\":\"Hello! This is an exclusive offer just for you from [Your Brand Name]. Enjoy 20% off your next purchase when you shop with us before 23.02. Don’t miss out on this limited-time deal! Visit our website or nearest store today to take advantage of this special discount. Thank you for being a valued customer!\",\n \"language\":\"en\",\n \"maxRingTime\": 10\n}")
.asString();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://dev.api.betatel.com/api/v1/callgen/call/commercial");
request.Headers.Add("x-api-key", "5326eed0b6f7a83a5bb08e8f5a5e6510a74eff7596736fdc80f09c7242a16f42");
request.Headers.Add("x-user-id", "675aed6103dee9ca55a36a9a");
var content = new StringContent("{\n \"callee\": \"38722222222\",\n \"caller\": \"38111111111\",\n \"text\":\"Hello! This is an exclusive offer just for you from [Your Brand Name]. Enjoy 20% off your next purchase when you shop with us before 23.02. Don’t miss out on this limited-time deal! Visit our website or nearest store today to take advantage of this special discount. Thank you for being a valued customer!\",\n \"language\":\"en\",\n \"maxRingTime\": 10\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Response
Once the call is initiated, the API will return a response confirming the operation:
JSON Schema:
{
"uuid": "string"
}
uuid
: A unique identifier to track the call and verify its status.
Congratulations
You’ve just unlocked a new way to connect with your customers! With the Commercial Call API, you can transform your marketing strategy by delivering personalized voice messages directly to your audience. Whether it’s a promotion, announcement, or exclusive offer, Betatel ensures your message is heard loud and clear. Start your journey today!