Send SMS API

Soap API includes two functions for send SMS and receive DLRs:

The wsdl (Web Service Definition Language) for our SOAP API can be found at:

http://sendbulksms.com/sms/api/soap/sms.wsdl

“send” for sms sending to one or multiple recipients

and

“query” for recieving delivery reports of sent messages to one or more recipients.

The “send” function accepts the following parameters:

username (string), username

password (string), password

from (string), sender’s identity

to (object), recipient(s)

message (string), message’s text

coding (string), coding that message will be sent. GSM, UTF-8.

flash (boolean), flash sms (true for flash SMS, false for normal SMS)

schedule (string), schedule time – date to send SMS

dlr-url (string), define delivery URL to receive message status

The parameter “to” is an object with one property. The property has the identifier recipients and it is one array of strings.

The schedule parameter has to be in English date format.

Examples for SCHEDULE_DATE_TIME:

  • 2011-07-04
  • 2011-04-07 14:47
  • 2011-04-22 17:47:55
  • 11 June 2011 11:00:00
  • +1 day
  • +1 week
  • +1 week 2 days 4 hours 2 seconds
  • next Thursday
  • last Monday
  • any valid string containing an English date format as this value is parsed with PHP function strtotime().

The dlr-url is the URL that you want to receive status of each sent message. All data will be send using POST method to your URL.

Delete scheduled Message:

Operation delete_message is used to delete a scheduled message.

The parameters for this request are:
username (string), username
password (string), password
id (string), message’s ID

This operation can return:
Success: true

Τhis request may return the following error messages:
Error: Authentication error.
Error: No message ID defined.
Error: No mobile defined.
Error: No message found.

The “send” function returns one ID for the sent message.

eg. 0047DL05

It returns the following exceptions:

Authentication error.

No recipients.

Coding not supported.

Invalid sender identity.

Insufficient credits.

Invalid scheduling date.

When a message gets a new status, a POST request will be performed (to the dlr-url if you have defined this value). The status will have two possible values: Failed or Delivered.

Example request that you can get:

$_POST["mid"] = “0008FABD”

$_POST["447869504953"] = “Delivered”

$_POST["447123456789"] = “Failed”

The “query” function accepts the following parameters:

username: (string), username

password: (string), password

message_id: (string), message’s ID

mobile: (string), recipient’s mobile

The “query” function returns the message’s delivery status for the specified recipient.

The returned values are:

Queued

Pending

Delivered

Failed

This request can return the following exceptions:

Authentication error.

No message ID defined.

No mobile defined.

No such message or recipient.

Sample code for SOAP API

<?php

// create soap client
$client = new SoapClient('http://sendbulksms.com/sms/api/soap/sms.wsdl');

// create recipients container
$to = new stdClass();
// add recipients
$to->recipients = array('306991111111', '306941234567');

// send message
$ID = $client->send('username', 'password', 'sender', $to, 'I am soap API!', 'UTF-8', true);

// check delivery status for each recipient
foreach( $to->recipients as $index => $recipient )
{
    echo $client->query('username', 'password', $ID, $recipient);
}

?>