Send Web SMS Via API

This call will allow you to send a Web SMS via API. The destination number and message body will be supplied in a csv or XLS file which needs to be made available via an external SFTP site. The remainder of the settings such as the file name, send time and originator are supplied via the API call.

Please note, to use this feature you will need to first setup an external SFTP site where the file can be collected. To do this please log into your account and go to ‘Send SMS’ -> ‘API Management’

Definition

http:// or https:// www.voodooSMS.com/vapi/server/sendWeb SMS/

Required Parameters

uid: System allocated username for API user configured within the VoodooSMS.com Portal in ‘Send SMS>API Management’
pass: System password for API user configured within the VoodooSMS.com Portal in ‘Send SMS>API Management’
orig: Maximum of 15 Numeric Digits or 11 alphanumeric (a-z, A-Z, 0-9 only) (The Sender ID is who the message appears from. A Sender ID must be greater than 4 characters. You can use up to 11 alphanumeric characters. Please note that some networks accept spaces whilst others do not and will remove them. Using the number ‘3’ in a Sender ID requires registration - please contact your Account Manager to discuss this.)
validity: 1 (always)
name: The name to apply to the Web SMS
file: The file name to collect - can be CSV or XLS variants
(The first column should be titled number and the second column with body as the title if you do not send message in msg param, you can download sample file here
locid: This is the ID of the SFTP configuration created within the portal.
format: Return format requested: XML, JSON or PHP data.

Optional Parameters

msg: The body of the SMS if just a list of contacts is supplied, if not supplied then the message body will be in the csv / xls
cc: Check & reformat destination number feature
This is an optional field, if you choose to specify the country code in the send SMS API Call, e.g. 44 (UK number) then the API will check that the specified destination numbers are valid. An example of this can be seen below.
If dest=447700900000 and cc=44 - no change will be made.
If dest=07700900000 and cc=44 - dest will be changed to 447700900000
If dest=7700900000 and cc=44 - dest will be changed to 447700900000
sd: To schedule a Send Web SMS API call for a future date use the sd parameter. The date and time must be in the future. If no timezone (tz) is specified then UTC is set as default.
tz: By default, our API uses the UTC (Coordinated Universal Time). If you want to make an API call different to UTC then simply add, or subtract the time from UTC. e.g. Melbourne, Australia is UTC+11 so the API call would be &tz=+11

Sending Web SMS to multiple destinations via API

Request

<?php
  switch($_SERVER["REQUEST_METHOD"]) {
    case "GET":
        $uid = htmlspecialchars($_GET["uid"]);
        $pass = htmlspecialchars($_GET["pass"]);
        $orig = htmlspecialchars($_GET["orig"]);
        $name = htmlspecialchars($_GET["name"]);
        $file = htmlspecialchars($_GET["file"]);
        $locid = htmlspecialchars($_GET["locid"]);
        $format = htmlspecialchars($_GET["format"]);
        break;
    case "POST":
        $uid = htmlspecialchars($_POST["uid"]);
        $pass = htmlspecialchars($_POST["pass"]);
        $orig = htmlspecialchars($_POST["orig"]);
        $name = htmlspecialchars($_POST["name"]);
        $file = htmlspecialchars($_POST["file"]);
        $locid = htmlspecialchars($_POST["locid"]);
        $format = htmlspecialchars($_POST["format"]);
        break;
}
$url = 'https://www.voodoosms.com/vapi/server/sendWebSMS?uid='.$uid.'&pass='.$pass.'&orig='.$orig
    .'&name='.$name.'&file='.$file.'&locid='.$locid.'&format='.$format;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
// Download the given URL, and return output
$output = curl_exec($ch);
echo $output."   ".curl_error($ch);
// Close the cURL resource, and free system resources
curl_close($ch);
?>
Response
<xml>
   <result>200</result>
   <status>1</status>
   <reference_id>fNDc3bavOZ36</reference_id>
</xml>

Summary

This API call will return the Web SMS current status and completion percentage.

Definition

http:// or https:// www.voodooSMS.com/vapi/server/statsWebSMS

Methods

GET
POST

Required Parameters

uid: System allocated username for API user configured within the VoodooSMS.com Portal in 'Send SMS > API Management'
pass: System password for API user configured within the VoodooSMS.com Portal in 'Send SMS > API Management'
reference id: The reference ID produced by the Send Web SMS API.
format: Return format requested: XML, JSON or PHP data.

Optional Parameters

limit: By default 5000 limit will apply if no limit set in API call
offset: Default 0

Checking Web SMS Summary

Request

<?php
    switch($_SERVER["REQUEST_METHOD"]) {
    case "GET":
        $uid = htmlspecialchars($_GET["uid"]);
        $pass = htmlspecialchars($_GET["pass"]);
        $reference_id = htmlspecialchars($_GET["reference_id"]);
        break;
    case "POST":
        $uid = htmlspecialchars($_POST["uid"]);
        $pass = htmlspecialchars($_POST["pass"]);
        $reference_id = htmlspecialchars($_POST["reference_id"]);
        break;
}
$url = 'https://www.voodoosms.com/vapi/server/statsWebSMS?uid='.$uid.'&pass='.$pass.
       '&reference_id='.$reference_id;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
// Download the given URL, and return output
$output = curl_exec($ch);
echo $output."   ".curl_error($ch);
// Close the cURL resource, and free system resources
curl_close($ch);

?>
Response
<xml>
   <result>200</result>
   <summary>
      <total_sent>3</total_sent>
      <total_complete>2</total_complete>
      <total_delivered>1</total_delivered>
      <total_pending>1</total_pending>
      <total_bounced>1</total_bounced>
   </summary>
   <data>
      <item>
         <sent_datetime>2018-06-28 14:40:00</sent_datetime>
         <broadcast_name>first websms via api</broadcast_name>
         <destination_number>44xxxxxxxxxx</destination_number>
         <delivery_status>delivered</delivery_status>
         <delivery_datetime>2018-06-28 14:42:00</delivery_datetime>
         <contact_list>first websms via api List</contact_list>
         <message>testing+124</message>
         <reference_id>301932205945wsms</reference_id>
      </item>
      <item>
         <sent_datetime>2018-06-28 14:40:00</sent_datetime>
         <broadcast_name>first websms via api</broadcast_name>
         <destination_number>44xxxxxxxxxx</destination_number>
         <delivery_status>pending</delivery_status>
         </delivery_datetime>
         <contact_list>first websms via api List</contact_list>
         <message>test+123</message>
         <reference_id>301932205946wsms</reference_id>
      </item>
      <item>
         <sent_datetime>2018-06-28 14:40:00</sent_datetime>
         <broadcast_name>first websms via api</broadcast_name>
         <destination_number>44xxxxxxxxxx</destination_number>
         <delivery_status>bounced</delivery_status>
         <delivery_datetime>2018-06-28 14:43:00</delivery_datetime>
         <contact_list>first websms via api List</contact_list>
         <message>testing+456</message>
         <reference_id>301932205947wsms</reference_id>
      </item>
   </data>
 </xml>