Send SMS messages to one or more destinations.
URL:
https://voip-communications.net/api-v2/index.php/sms/send
Method:
POST
Authentication:
Basic
Parameters:
- from (optional): If empty the message will be considered a BULK message (lower rate), otherwise, the phone number must belong to you and be SMS enabled, in this case, the message will be considered 2 Way SMS, the replies will be notified to the Callback URL defined for the phone number.
- to (required): Phone numbers to send the message to. You can specify more than one phone number separate them by commas “,”
- msg (required): Message to be sent. If the message length is more than 160 characters, the message will be split it into messages of 153 characters each
- delivery_date (optional): Date to deliver the message in the next format YYYY-MM-DD HH:MM or any valid date format; If empty, the message will be delivered immediately. For messages scheduled to be delivered later, the charge will be applied just at the moment of the message be sent; you can delete messages for late delivery from the SMS Log or through the [API]
HTTP Response Codes:
- 200: Success
- 401: Invalid api credentials
Response data:
You will get a JSON array with the log of each SMS processed.
{
"send_log": [
{
"code": 200,
"code_desc": "",
"from": "17134567890",
"to": "12812345678",
"country": "US",
"msg": "It is a SMS message",
"delivery_date": "2019-10-01 00:00:00",
"sale": 0.01,
"type": "BULKSMS",
"status": "SCHEDULED",
"smsid": "2017559ea27008c6b7122900621"
}
]
}
Please note “smsid” into the response. ; It is a unique code for the process, and it is required to cancel the request (just if it is a scheduled SMS). [click here] to see API methods to list/delete scheduled SMS.
Curl Example
curl -u YOUR_API_KEY:YOUR_API_PASSWORD
--data"to=TO_NUMBER&msg=TEXT_MESSAGE"
https://voip-communications.net/api-v2/index.php/sms/send
PHP Example
$service_url = "https://voip-communications.net/api-v2/index.php/sms/send";
$curl = curl_init($service_url);
curl_setopt($curl, CURLOPT_USERPWD, "YOUR_API_KEY:YOUR_API_PASSWORD");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$post_fields = array("from" => "FROM_NUMBER",
"to" => "TO_NUMBER",
"msg" => "TEXT_MESSAGE",
"delivery_date" => "2010-01-01 13:15");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post_fields));
$curl_response = curl_exec($curl);
if ($curl_response !== false) {
$http_code = curl_getinfo($curl,CURLINFO_HTTP_CODE);
if ($http_code == "200") {
$result = json_decode($curl_response,true);
print_r($result);
}
}
curl_close($curl);
