Send Voice Call (Text To Speech)
APIs for sending Voice Call (Text to Speech)
Please note for now that on Sandbox/Test Environment we simulate the Voice Call on our Simulator. Use the simulator here

Base URL

Depending on your environment, use any of these Base URL below
Live Base URL: https://api.sendchamp.com/api/v1/
Sandbox Base URL: https://sandbox-api.sendchamp.com/api/v1/
  1. 1.
    Find the Access Key for Authentication under Account Settings on your Dashboard.
  2. 2.
    When you use Sandbox Environment, your messages can be found on our simulator here
post
https://{BASE_URL}
/api/v1/voice/send
Send Voice (Text-to-Speech)

Code Samples

CURL
JSON
PHP
NODE
JAVASCRIPT
PYTHON
C#
JAVA
RUBY
1
curl --request POST \
2
--url https://api.sendchamp.com/api/v1/voice/send \
3
--header 'Accept: application/json' \
4
--header 'Authorization: Bearer SECRET_KEY' \
5
--header 'Content-Type: application/json' \
6
--data '
7
{
8
"customer_mobile_number": "2349039099438",
9
"message": "testing voice service",
10
"type": "outgoing",
11
"repeat": 3
12
}
13
'
Copied!
1
{
2
"customer_mobile_number": "2348119974190",
3
"message": "Hello from Olumide",
4
"type": "outgoing",
5
"repeat": 2
6
}
Copied!
1
<?php
2
3
$curl = curl_init();
4
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://api.sendchamp.com/api/v1/voice/send',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'POST',
14
CURLOPT_POSTFIELDS =>'{
15
"customer_mobile_number": "2348119974190",
16
"message": "Hello from Olumide",
17
"type": "outgoing",
18
"repeat": 2
19
}',
20
CURLOPT_HTTPHEADER => array(
21
'Content-Type: application/json',
22
'Accept: application/json',
23
'Authorization: Bearer SECRET_KEY'
24
),
25
));
26
27
$response = curl_exec($curl);
28
29
curl_close($curl);
30
echo $response;
31
Copied!
1
var request = require('request');
2
var options = {
3
'method': 'POST',
4
'url': 'https://api.sendchamp.com/api/v1/voice/send',
5
'headers': {
6
'Content-Type': 'application/json',
7
'Accept': 'application/json',
8
'Authorization': 'Bearer SECRET_KEY'
9
},
10
body: JSON.stringify({"customer_mobile_number":"2348119974190","message":"Hello from Olumide","type":"outgoing","repeat":2})
11
12
};
13
request(options, function (error, response) {
14
if (error) throw new Error(error);
15
console.log(response.body);
16
});
17
Copied!
1
var data = JSON.stringify({"customer_mobile_number":"2348119974190","message":"Hello from Olumide","type":"outgoing"});
2
3
var xhr = new XMLHttpRequest();
4
xhr.withCredentials = true;
5
6
xhr.addEventListener("readystatechange", function() {
7
if(this.readyState === 4) {
8
console.log(this.responseText);
9
}
10
});
11
12
xhr.open("POST", "https://api.sendchamp.com/api/v1/voice/send");
13
xhr.setRequestHeader("Content-Type", "application/json");
14
xhr.setRequestHeader("Accept", "application/json");
15
xhr.setRequestHeader("Authorization", "Bearer SECRET_KEY");
16
17
xhr.send(data);
Copied!
1
import requests
2
3
url = "https://api.sendchamp.com/api/v1/voice/send"
4
5
payload="{\n \"customer_mobile_number\": \"2348119974190\",\n \"message\": \"Hello from Olumide\",\n \"type\": \"outgoing\",\n \"repeat\":2 \n}"
6
headers = {
7
'Content-Type': 'application/json',
8
'Accept': 'application/json',
9
'Authorization': 'Bearer SECRET_KEY'
10
}
11
12
response = requests.request("POST", url, headers=headers, data=payload)
13
14
print(response.text)
Copied!
1
var client = new RestClient("https://api.sendchamp.com/api/v1/voice/send");
2
client.Timeout = -1;
3
var request = new RestRequest(Method.POST);
4
5
request.AddHeader("Content-Type", "application/json");
6
request.AddHeader("Accept", "application/json");
7
request.AddHeader("Authorization", "Bearer SECRET_KEY");
8
request.AddParameter("application/json", "{\n \"customer_mobile_number\": \"2348119974190\",\n \"message\": \"Hello from Olumide\",\n \"type\": \"outgoing\",\n \"repeat\":2\n}", ParameterType.RequestBody);
9
10
IRestResponse response = client.Execute(request);
11
12
Console.WriteLine(response.Content);
Copied!
1
Unirest.setTimeouts(0, 0);
2
HttpResponse<String> response = Unirest.post("https://api.sendchamp.com/api/v1/voice/send")
3
.header("Content-Type", "application/json")
4
.header("Accept", "application/json")
5
.header("Authorization", "Bearer sendchamp_test_$2y$10$U2SHG5T2F/cr0jfzNCKgguHv.23plvJP/75EzZjF5MtLXz65SDrQi")
6
.body("{\n \"customer_mobile_number\": \"2348119974190\",\n \"message\": \"Hello from Olumide\",\n \"type\": \"outgoing\",\n \"repeat\":2\n}")
7
.asString();
8
Copied!
1
require "uri"
2
require "net/http"
3
4
url = URI("https://api.sendchamp.com/api/v1/voice/send")
5
6
https = Net::HTTP.new(url.host, url.port)
7
https.use_ssl = true
8
9
request = Net::HTTP::Post.new(url)
10
request["Content-Type"] = "application/json"
11
request["Accept"] = "application/json"
12
request["Authorization"] = "Bearer SECRET_KEY"
13
request.body = "{\n \"customer_mobile_number\": \"2348119974190\",\n \"message\": \"Hello from Olumide\",\n \"type\": \"outgoing\",\n \"repeat\":2\n}"
14
15
response = https.request(request)
16
puts response.read_body
Copied!

Postman Collection

If you have not downloaded the Postman Collection for a quick test, you can do that here

Libraries/SDKs

We would be releasing libraries/SDKs for more easier integrations in your favorite language/framework. If you happen to create one, do let us know via our community and we would be happy to work on making it the official library and some other benefits.

Feedback

We always want to hear about your experience using our API documentation. If you have any comments 😌 or want to tell us good work 😁 , please do tell us here and we will call you.
Don't forget to join our community here
Last modified 21h ago