Text CALL to 88440
info@voodooSMS.com

+44 (0)1484 599 311

Login Free Account

Developer Tools

Free Account
Our new API is live!

Our new API is now available to use. We have improved the methods that you are familiar with, offering you a clearer understanding of what each property can do and a more detailed response from each call.

The old API is still fully functioning and support for this will not end.

We are also introducing API Keys which are used to access the API methods and improve the security around using the API.

Click here to see the new Developer page.

Click here to read our new Developer Documentation.

Send SMS

This call allows you to send SMS to one or multiple destinations.

Definition

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

METHODS

GET

POST

Parameters

Required Fields

dest:

Format: 447700900000 (where 44 is country code e.g. 44 is UK). Multiple destinations can be separated with commas e.g. 447700900000,447700777888. When numbers presented are not in the correct country code format, use the 'cc' parameter to correct the country code formatting.

You can also send a message to all numbers within' a contact list.

To do this, instead of adding numbers to the dest= parameter, use the format c1234 where 1234 is the ID of the contact list with the numbers in you wish to message

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.)

msg:

Up to 160 for standard length message (per SMS Credit), between 160 and 918 characters for long messages. Special characters to be URL Encoded (%xx where xx is ASCII Hex value for character, e.g. %20 for space or + can be used for a space). See the URL Encoding section later on in this document.

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’

validity:

1 (always)

format:

Return format requested: XML, JSON or PHP data.

Optional Parameters

cc:

Check & reformat destination number feature
This is an optional field, if you choose to specify the country code in the sendSMS API Call, e.g. 44 and the API will check that the specified destination number Examples

  • 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 SendSMS API call in the future use the sd parameter. The date and time must be in the future. If no timezone (tz) is specified then UTC is the 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. for Melbourne, Australia is UTC+11 so the API call would be &tz=+11

autolist:

Specify the id of the Auto Contact List e.g. autolist=1 See the Auto List Section later in the document for an explanation of this feature.

tc:

Truncate Sender ID - If tc=1 is supplied, then the platform will automatically truncate the Sender ID to the maximum 11 characters permitted. e.g. 'Truncated Sender’ will become ‘Truncated S’

qt:

Quiet Times - If qt=1 is specified in the API call, then the platform will check if Quiet Times is enabled for the specified API credentials used, and if so use the API Quiet Times configuration (Account -> Quiet Times) to check that the SMS can be sent at the current time and day. If the current day and time falls outside of the existing Quiet Times configuration, the SMS will not be sent until the current quiet time period has ended.

eref:

External Reference - This allows you to specify your own reference value which will be stored within the platform, up to 30 characters in length. This, in conjunction with the getDLRer API call which will also specify the er value supplied.

Single textual message to single destinations

Request


<?php
switch($_SERVER["REQUEST_METHOD"]) {
    case "GET":
        $uid = htmlspecialchars($_GET["uid"]);
        $pass = htmlspecialchars($_GET["pass"]);
        $dest = htmlspecialchars($_GET["dest"]);
        $orig = htmlspecialchars($_GET["orig"]);
        $msg = htmlspecialchars($_GET["msg"]);
        $format = htmlspecialchars($_GET["format"]);
        break;
    case "POST":
        $uid = htmlspecialchars($_POST["uid"]);
        $pass = htmlspecialchars($_POST["pass"]);
        $dest = htmlspecialchars($_POST["dest"]);
        $orig = htmlspecialchars($_POST["orig"]);
        $msg = htmlspecialchars($_POST["msg"]);
        $format = htmlspecialchars($_POST["format"]);
        break;
}

$url = 'https://www.voodoosms.com/vapi/server/sendSMS?uid='.$uid.'&pass='.$pass.
        '&dest='.$dest.'&orig='.$orig."&msg=".$msg."&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);
?>

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class Servlet extends HttpServlet {
    public void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {

        if(request.getAttribute("uid") != null && request.getAttribute("pass") != null
            && request.getAttribute("dest") != null && request.getAttribute("orig") != null
            && request.getAttribute("msg") != null && request.getAttribute("format") != null)
        {
            String charset = "UTF-8";
            String query = String.format("uid=%s&pass=%s&dest=%s&orig=%s&msg=%s&format=%s",
             URLEncoder.encode(request.getAttribute("uid").toString(), charset),
             URLEncoder.encode(request.getAttribute("pass").toString(), charset),
             URLEncoder.encode(request.getAttribute("dest").toString(), charset),
             URLEncoder.encode(request.getAttribute("orig").toString(), charset),
             URLEncoder.encode(request.getAttribute("msg").toString(), charset),
             URLEncoder.encode(request.getAttribute("format").toString(), charset));
            String url = "www.voodoosms.com/vapi/server/sendSMS";

            URLConnection connection = new URL(url + "?" + query).openConnection();
            connection.setRequestProperty("Accept-Charset", charset);
            InputStream reqres = connection.getInputStream();
            // reqres contains the request output
        }
        else {
        	// Wrong parameters
        }
    }
    public void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
    	// Same as GET
    }
}

var http = require('http');
var https = require('https');
var querystring = require('querystring');
var url = require('url');

var server = http.createServer(function(req, res) {

    var url_parts = url.parse(req.url, true);
    var query = url_parts.query;
    var uid = query.uid;
    var pass = query.pass;
    var orig = query.orig;
    var dest = query.dest;
    var msg = query.msg;
    var format = query.format;

    if(uid && pass && orig && dest && msg && format) {
        var get_data = querystring.stringify({
          "uid" : uid, "pass": pass, "dest": dest, "orig": orig, "msg" : msg, "format" : format
        });

        var options = {
            host: 'www.voodoosms.com',
            path: '/vapi/server/sendSMS?' + get_data
        }

        https.get(options, function(reqres) {
          reqres.on('data', function(chunk) {
            res.end(chunk);
          })
        });

    }
    else
      res.end("Wrong parameters");
});

server.listen(8080);

require 'net/http'
require 'json'

class Controller < ApplicationController
    def index
    uid = params[:uid]
    pass = params[:pass]
    dest = params[:dest]
    orig = params[:orig]
    msg = params[:msg]
    form = params[:form]

    if uid and pass and dest and orig and msg and form
        uri = "?uid=" + uid + "&pass=" + pass + "&dest=" + dest + "&orig=" + orig + "&msg=" + msg +
                "&format=" + form
    else
        uri = 0
    end

    if uri != 0
        url = URI.parse('http://www.voodoosms.com/vapi/server/sendSMS' + uri)
        uri = URI(url)
        response = Net::HTTP.get(uri)
        @res = response
    else
        @res = "Wrong parameters"
    end
  end
end

from django.http
import HttpResponse, HttpRequest
import urllib2

def index(request):

    if request.method == 'GET':
        uid = request.GET.get('uid', '')
        pas = request.GET.get('pass', '')
        form = request.GET.get('format', '')
        msg = request.GET.get('msg', '')
        orig = request.GET.get('orig', '')
        dest = request.GET.get('dest', '')
    elif request.method == 'POST':
        uid = request.POST.get('uid', '')
        pas = request.POST.get('pass', '')
        form = request.POST.get('format', '')
        msg = request.POST.get('msg', '')
        orig = request.POST.get('orig', '')
        dest = request.POST.get('dest', '')

    if uid and pas and form and msg and orig and dest :
        u = "?uid=%s&pass=%s&dest=%s&orig=%s&msg=%s&format=%s" % (uid, pas, dest, orig, msg, form)
    else :
        u = 0

    if u :
        res = urllib2.urlopen("https://voodoosms.com/vapi/server/sendSMS" + u).read()
        return HttpResponse(res)
    else :
        return HttpResponse("Wrong parameters")

using System;
using System.Net.Http;
using System.Web;

var client = new HttpClient();

//Get the parameters, either GET or POST request
    string uid = HttpContext.Current.Server.HtmlEncode(Request["uid"]);
    string pass = HttpContext.Current.Server.HtmlEncode(Request["pass"]);
    string dest = HttpContext.Current.Server.HtmlEncode(Request["dest"]);
    string orig = HttpContext.Current.Server.HtmlEncode(Request["orig"]);
    string msg = HttpContext.Current.Server.HtmlEncode(Request["msg"]);
    string format = HttpContext.Current.Server.HtmlEncode(Request["format"]);

//Exit if one or more parameters is missing
    if(String.IsNullOrEmpty(uid) || String.IsNullOrEmpty(pass) || String.IsNullOrEmpty(dest)
    || String.IsNullOrEmpty(orig) || String.IsNullOrEmpty(msg) || String.IsNullOrEmpty(format))
    System.Environment.Exit(1)
    
// Send the async request
    HttpResponseMessage response = await client.GetAsync(
    "https://www.voodoosms.com/vapi/server/sendSMS?uid=" + uid + "&pass=" + pass
    + "&dest=" + dest + "&orig=" + orig + "&msg=" + msg + "&format=" + format);

// Get the response content
HttpContent responseContent = response.Content;

// Get the stream of the content and write the output
using (var reader = new StreamReader(await responseContent.ReadAsStreamAsync()))
{
Console.WriteLine(await reader.ReadToEndAsync());
}

Response


<xml>
   <result>200</result>
   <resultText>200 OK</resultText>
   <reference_id>
      <item>ss3SliH1ZvlxQtv07262607171vapi</item>
   </reference_id>
</xml>

On success, the response header HTTP status code will be 200 OK confirming that the message is sent. If you try to send message without authorisation you an error code of 401 Unauthorized will be received.

SMSResponseDetails

Parameter Type Description
result int 200
resulText String 200 OK
item String This is the references number that is returned with the delivery report

Additional examples


Single textual message to multiple destinations

Request


<?php
$url = "www.voodooSMS.com/vapi/server/sendSMS";
$getString ="?dest=447626691405,447626691255,447626691403&&";
$getString .="orig=TestingAPI&";
$getString .="msg=".urlencode("Testing The API")."&";
$getString .="pass=password&";
$getString .="uid=username&";
$getString .="validity=1";
$ch = curl_init();
//set the url, GET data
curl_setopt($ch, CURLOPT_URL, $url.$getString);
curl_setopt($ch, CURLOPT_HTTPGET,1); //default
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
//execute post
$result = curl_exec($ch);
echo($result);
//close connection
curl_close($ch);
?>

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class Servlet extends HttpServlet {
    public void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {

        if(request.getAttribute("uid") != null && request.getAttribute("pass") != null
            && request.getAttribute("dest") != null && request.getAttribute("orig") != null
            && request.getAttribute("msg") != null && request.getAttribute("format") != null)
        {
        	String charset = "UTF-8";
            String query = String.format("uid=%s&pass=%s&dest=%s&orig=%s&msg=%s&format=%s",
             URLEncoder.encode(request.getAttribute("uid").toString(), charset),
             URLEncoder.encode(request.getAttribute("pass").toString(), charset),
             URLEncoder.encode(request.getAttribute("dest").toString(), charset),
             URLEncoder.encode(request.getAttribute("orig").toString(), charset),
             URLEncoder.encode(request.getAttribute("msg").toString(), charset),
             URLEncoder.encode(request.getAttribute("format").toString(), charset));
             String url = "www.voodoosms.com/vapi/server/sendSMS";

            URLConnection connection = new URL(url + "?" + query).openConnection();
            connection.setRequestProperty("Accept-Charset", charset);
            InputStream reqres = connection.getInputStream();
            // reqres contains the request output
        }
        else {
        	// Wrong parameters
        }
    }
    public void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
    	// Same as GET
    }
}

var http = require('http');
var https = require('https');
var querystring = require('querystring');
var url = require('url');

var server = http.createServer(function(req, res) {

    var url_parts = url.parse(req.url, true);
    var query = url_parts.query;
    var uid = query.uid;
    var pass = query.pass;
    var orig = query.orig;
    var dest = query.dest;
    var msg = query.msg;
    var format = query.format;

    if(uid && pass && orig && dest && msg && format) {
        var get_data = querystring.stringify({
          "uid" : uid, "pass": pass, "dest": dest, "orig": orig, "msg" : msg, "format" : format
        });

        var options = {
            host: 'www.voodoosms.com',
            path: '/vapi/server/sendSMS?' + get_data
        }

        https.get(options, function(reqres) {
          reqres.on('data', function(chunk) {
            res.end(chunk);
          })
        });

    }
    else
      res.end("Wrong parameters");
});

server.listen(8080);

require 'net/http'
require 'json'

class Controller < ApplicationController
    def index
    uid = params[:uid]
    pass = params[:pass]
    dest = params[:dest]
    orig = params[:orig]
    msg = params[:msg]
    form = params[:form]

    if uid and pass and dest and orig and msg and form
        uri = "?uid=" + uid + "&pass=" + pass + "&dest=" + dest + "&orig=" + orig + "&msg=" + msg +
                "&format=" + form
    else
        uri = 0
    end

    if uri != 0
        url = URI.parse('http://www.voodoosms.com/vapi/server/sendSMS' + uri)
        uri = URI(url)
        response = Net::HTTP.get(uri)
        @res = response
    else
        @res = "Wrong parameters"
    end
  end
end

from django.http
import HttpResponse, HttpRequest
import urllib2

def index(request):

    if request.method == 'GET':
        uid = request.GET.get('uid', '')
        pas = request.GET.get('pass', '')
        form = request.GET.get('format', '')
        msg = request.GET.get('msg', '')
        orig = request.GET.get('orig', '')
        dest = request.GET.get('dest', '')
    elif request.method == 'POST':
        uid = request.POST.get('uid', '')
        pas = request.POST.get('pass', '')
        form = request.POST.get('format', '')
        msg = request.POST.get('msg', '')
        orig = request.POST.get('orig', '')
        dest = request.POST.get('dest', '')

    if uid and pas and form and msg and orig and dest :
        u = "?uid=%s&pass=%s&dest=%s&orig=%s&msg=%s&format=%s" % (uid, pas, dest, orig, msg, form)
    else :
        u = 0

    if u :
        res = urllib2.urlopen("https://voodoosms.com/vapi/server/sendSMS" + u).read()
        return HttpResponse(res)
    else :
        return HttpResponse("Wrong parameters")

using System;
using System.Net.Http;
using System.Web;

var client = new HttpClient();

//Get the parameters, either GET or POST request
    string uid = HttpContext.Current.Server.HtmlEncode(Request["uid"]);
    string pass = HttpContext.Current.Server.HtmlEncode(Request["pass"]);
    string dest = HttpContext.Current.Server.HtmlEncode(Request["dest"]);
    string orig = HttpContext.Current.Server.HtmlEncode(Request["orig"]);
    string msg = HttpContext.Current.Server.HtmlEncode(Request["msg"]);
    string format = HttpContext.Current.Server.HtmlEncode(Request["format"]);

//Exit if one or more parameters is missing
    if(String.IsNullOrEmpty(uid) || String.IsNullOrEmpty(pass) || String.IsNullOrEmpty(dest)
    || String.IsNullOrEmpty(orig) || String.IsNullOrEmpty(msg) || String.IsNullOrEmpty(format))
    System.Environment.Exit(1)

// Send the async request
    HttpResponseMessage response = await client.GetAsync(
    "https://www.voodoosms.com/vapi/server/sendSMS?uid=" + uid + "&pass=" + pass
    + "&dest=" + dest + "&orig=" + orig + "&msg=" + msg + "&format=" + format);

// Get the response content
HttpContent responseContent = response.Content;

// Get the stream of the content and write the output
using (var reader = new StreamReader(await responseContent.ReadAsStreamAsync()))
{
Console.WriteLine(await reader.ReadToEndAsync());
}

Response


<xml>
    <result>200</result>
    <resultText>200OK</resultText>
    <reference_id>
      <item>5883U8YDCF08122712161</item>
      <item>5MH2R672QD08122712162</item>
      <item>X9742DETI008122712163</item>
    </reference_id>
</xml>
{
    "requestError": {
        "serviceException": {
            "messageId": "UNAUTHORIZED",
            "text": "Invalid login details"
        }
    }
}
METHOD POST
Request Headers
Accept: */*
Referer: http:// or https:// www.voodoosms.com/vapi/server
authorization: Basic ZGZkZjpzZGZkZg==
accept-encoding: gzip, deflate
content-type: application/json
content-length: 64
URL http:// or https:// www.voodoosms.com/vapi/server/sendSMS
Request Data
{
    "from": "447711112244",
    "to": [
        "447788112233"
    ],
    "text": "tsdsdsd"
}
Status
Response Headers
access-control-allow-origin: *
access-control-allow-methods: GET, POST, PUT, PATCH, DELETE, COPY, HEAD, OPTIONS, LINK, UNLINK,
PURGE access-control-allow-headers: Authorization, Content-Type, X-Enrollment-Token
content-type: application/json;charset=UTF-8
content-length: 97
date: Tue, 27 Dec 2016 08:17:07 GMT
connection: close
server: SMS API
strict-transport-security: max-age=16000000; includeSubDomains; preload;