http://<domain_name>/api/voice/voice_broadcast_tts.php?username=<username>&token=<token>&content=<content>&plan_id=<plan_id>&contact_numbers=<contact_number1[,contact_number2,...]>[&caller_id=<caller_id>]
Voice Broadcast API TTS through Sarv
request.post({url:'http://<domain_name>/api/voice/voice_broadcast.php', formData: {'username':'username','token':'abcXYZ','announcement_id':'announcement_id','plan_id':'plan_id','contact_numbers':'contact_numbers[,'contact_numbers....']',['caller_id':'caller_id']'}}, function optionalCallback(err, httpResponse, body) {
if (err) {
return console.error('upload failed:', err);
}
console.log('Upload successful! Server responded with:', body);
console.log(body);
/*
{
"status":"success",
"code":"000",
"desc":"Call Submitted Successfully",
"data":[
{
"contact_number":"1234XXXXXX",
"unique_id":"12X_24X_XX",
"sarv_api_uniqueid":"12X_24X_XX",
},
{
"contact_number":"1234XXXXXX",
"unique_id":"12X_24X_XX",
"sarv_api_uniqueid":"12X_24X_XX",
},
{
"contact_number":"1234XXXXXX",
"unique_id":"12X_24X_XX",
"sarv_api_uniqueid":"12X_24X_XX",
},
]
}
*/
});
{
"status":"success",
"code":"000",
"desc":"Call Submitted Successfully",
"data":[
{
"contact_number":"1234XXXXXX",
"unique_id":"12X_24X_XX",
"sarv_api_uniqueid":"12X_24X_XX",
},
{
"contact_number":"1234XXXXXX",
"unique_id":"12X_24X_XX",
"sarv_api_uniqueid":"12X_24X_XX",
},
{
"contact_number":"1234XXXXXX",
"unique_id":"12X_24X_XX",
"sarv_api_uniqueid":"12X_24X_XX",
},
]
}
{
"status":"error",
"code":"002",
"desc":"Parameter is blank."
}
| Parameters |
| username* string |
a valid Sarv SMS Panel username |
| token* string |
a valid token |
| content* text |
Enter announcement text |
| plan_id* string |
Voice plan_id for sending voice call |
| caller_id* integer |
Approved caller id |
| contact_numbers* integer |
a valid contact number (, seperated for multiple contacts) Max : 50 Contact Numbers |
* compulsory field
| Return Value: Success |
| struct |
the results of Voice Broadcast TTS
| status string |
success |
| code string |
000 |
| desc string |
Description of success |
| data array |
array of contact numbers and respective unique ids. |
|
|
| Return Value: Error |
| struct |
the error results when Voice Broadcast TTS
| status string |
error |
| code string |
007 |
| desc string |
description of error |
|
|
| Api Response Codes |
| 000 |
Call Submitted Successfully. |
| 001 |
Parameter Missing . |
| 002 |
Parameter is blank. |
| 003 |
Request IP not added in whitelist . |
| 004 |
Invalid user type. |
| 005 |
Invalid Credentials. |
| 006 |
User is InActive. |
| 008 |
Exceeded contact no limit for single api call . |
| 010 |
Invalid caller id . |
| 011 |
Some issue in credit fetch . |
| 014 |
There is no plan assign to parent . |
| 015 |
Voice Amount Validity Expired . |
| 016 |
Low voice amount to your parent . |
| 017 |
No gateway available for voice broadcast . |
| 019 |
Invalid User Voice Plan . |
| 020 |
Caller id is not host on any gateway . |