Resource

http://smsapi.cyberdeveloperbd.com/sms/2/text/single

Parameters

Type Property name Description
from string Represents sender ID and it can be alphanumeric or numeric. Alphanumeric sender ID length should be between 3 and 11 characters (example: CompanyName). Numeric sender ID length should be between 3 and 14 characters.
to array_string Array of message destination addresses. If you want to send a message to one destination, a single String is supported instead of an Array. Destination addresses must be in international format (example: 41793026727).
text string Text of the message that will be sent.

 

Request Example

JSON

POST /sms/2/text/single HTTP/1.1
Host: smsapi.cyberdeveloperbd.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json

{
"from":"InfoSMS",
"to":"41793026727",
"text":"Test SMS."
}

Response

{
"messages":[
{
"to":"41793026727",
"status": {
"groupId": 1,
"groupName": "PENDING",
"id": 26,
"name": "PENDING_ACCEPTED",
"description": "Message sent to next instance"
},
"messageId": "2033247207850523790"
}
]
}

 

Long SMS:

The maximum length of one message is 160 characters for the GSM7 standard or 70 characters for Unicode encoded messages. If you send a text which exceeds the maximum number of supported characters, the sent message will be segmented and charged accordingly. One Long SMS that consists of two SMS counts as two SMS.

Response Format

If successful, the response header HTTP status code will be 200 OK and the message will be sent.

If you try to send a message without authorization, you will receive an error 401 Unauthorized.

Additionally you should also handle the 400 Bad request status. For more info on HTTP status handling see dedicated section in Integration best practices page.

SMS Response

Parameter Type Description
bulkId String The ID that uniquely identifies the request. Bulk ID will be received only when you send a message to more than one destination address.
messages SMSResponseDetails Array of sent message objects, one object per every message.

 

SMS Response Details

Parameter Type Description
to String The message destination address.
status status Indicates whether the message is successfully sent, not sent, delivered, not delivered, waiting for delivery or any other possible status.
messageId String The ID that uniquely identifies the message sent.

 

Status

Parameter Type Description
groupId int Status group ID.
groupName String Status group name.
ID int Status ID.
name
String Status name.
description String Human-readable description of the status.
action String Action that should be taken to eliminate the error.

 

SMS status

When sending SMS messages, Bulk SMS API returns the response with status PENDING_ACCEPTED and continues processing of SMS asynchronously. You can check the delivery status of your message using the Get delivery reports API endpoint.

Additional examples

Single textual message to one destination

Request:

JSON

POST /sms/2/text/single HTTP/1.1
Host: smsapi.cyberdeveloperbd.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json

{
"from":"InfoSMS",
"to":"41793026727",
"text":"Test SMS."
}

 

XML

POST /sms/2/text/single HTTP/1.1
Host: smsapi.cyberdeveloperbd.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/xml
Accept: application/xml

InfoSMS

41793026727

Test SMS.

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "http://smsapi.cyberdeveloperbd.com/sms/2/text/single",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{ \"from\":\"InfoSMS\", \"to\":\"41793026727\", \"text\":\"Test SMS.\" }",
CURLOPT_HTTPHEADER => array(
"accept: application/json",
"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
"content-type: application/json"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}

JavaScript

var data = JSON.stringify({
"from": "InfoSMS",
"to": "41793026727",
"text": "Test SMS."
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = false;

xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});

xhr.open("POST", "http://smsapi.cyberdeveloperbd.com/sms/2/text/single");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("accept", "application/json");

xhr.send(data);

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
"messages":[
{
"to":"41793026727",
"status":{
"groupId":1,
"groupName":"PENDING",
"id":26,
"name":"MESSAGE_ACCEPTED",
"description":"Message sent to next instance"
},
"messageId":"2250be2d4219-3af1-78856-aabe-1362af1edfd2"
}
]
}

Single textual message to multiple destination

Request:

JSON

HTTP/1.1 200 OK
Content-Type: application/json

{
"messages":[
{
"to":"41793026727",
"status":{
"groupId":1,
"groupName":"PENDING",
"id":26,
"name":"MESSAGE_ACCEPTED",
"description":"Message sent to next instance"
},
"messageId":"2250be2d4219-3af1-78856-aabe-1362af1edfd2"
}
]
}

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "http://smsapi.cyberdeveloperbd.com/sms/2/text/single",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{ \"from\":\"InfoSMS\", \"to\":[ \"41793026727\", \"41793026834\" ], \"text\":\"Test SMS.\" }",
CURLOPT_HTTPHEADER => array(
"accept: application/json",
"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
"content-type: application/json"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}

JavaScript

var data = JSON.stringify({
"from": "InfoSMS",
"to": [
"41793026727",
"41793026834"
],
"text": "Test SMS."
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = false;

xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});

xhr.open("POST", "http://smsapi.cyberdeveloperbd.com/sms/2/text/single");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("accept", "application/json");

xhr.send(data);

Response:

JSON

HTTP/1.1 200 OK
Content-Type: application/json

{
"bulkId":"f5c4322c-10e7-a41e-5528-34fa0b032134",
"messages":[
{
"to":"41793026727",
"status":{
"groupId":1,
"groupName":"PENDING",
"id":26,
"name":"PENDING_ACCEPTED",
"description":"Message sent to next instance"
},
"messageId":"2033247207850523791"
},
{
"to":"41793026834",
"status":{
"groupId":1,
"groupName":"PENDING",
"id":26,
"name":"PENDING_ACCEPTED",
"description":"Message sent to next instance"
},
"messageId":"2033247207850523792"
}
]
}

Comments

comments