Navbar
Java PHP C# Python NodeJS
  • Introduction
  • Authentication
  • SMS Gateway REST API
  • IM Gateway REST API
  • OTP Gateway REST API
  • Callback Responses
  • Balance
  • Error Codes
  • SDK
  • Introduction

    Apifon offers numerous ways for you to connect your applications to our ADMS (Apifon Distributed Messaging System), allowing your systems to seamlessly communicate with your customers anywhere in the world.

    One way to use our services is via the SMPP protocol, which effectively links your application to our SMSC servers. To set up an SMPP bind, please contact support@apifon.com. Also available, is our HTTP interface, which offers our API to enable your application to send out SMS and IM messages.

    The following two images explain how the Apifon REST API messaging and callback services work.

    alt text

    alt text

    Sign Up

    Before continuing, please take a moment to register with our platform, Mookee.

    Authentication

    To make use of the REST API, you must supply with each request an authorization token in the HTTP header. The token (ApifonWS) at this point will be generated automatically through Apifon’s Service Control Panel (Mookee) and will be given to you via email.

    The Authentication Header

    Authorization: ApifonWS [Token]:[Signature]
    

    Setting Authorization Header Code Example

    import org.apache.http.client.methods.HttpPost;
    
    HttpPost request = new HttpPost();
    
    request.setHeader("Authorization", "ApifonWS " + token + ":" + signature);
    
    $curl = curl_init($url);
    
    $header[] = "Authorization: ApifonWS " . $token . ":" . $signature;
    
    curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
    
    WebRequest webRequest = WebRequest.Create(uri);
    
    webRequest.Headers["Authorization"] = "ApifonWS " + token + ":" + signature;
    
    headers = {
        "Authorization": "ApifonWS %s: %s" % (token, signature),
    }
    
    connection = http.client.HTTPConnection(base_url)
    connection.request(method, endpoint, body, headers)
    
    var request = require('sync-request');
    
    var res = request(method, url, {
        headers: {
            'Authorization': 'ApifonWS ' + token + ":" + signature,
        },
        body: body
    });
    

    The ApifonWS REST API uses the standard HTTP Authorization header to pass authentication information. (The name of the standard header is unfortunate because it carries authentication information, not authorization.) Under the ApifonWS authentication scheme, the Authorization header has the following form:

    When developers register they are issued an ApifonWS token and ApifonWS secret access key. For request authentication, the ApifonWS token element is used to indirectly retrieve the secret key to compute the signature and, thus, identify the developer making the request.

    Authorization Instructions:

    Authorization = "ApifonWS" + " " + Token + ":" + Signature
    
    Signature = Base64( HMAC-SHA256( YourSecretAccessKeyID, UTF-8-Encoding-Of( StringToSign ) ) );
    
    StringToSign = HTTP-Verb + "\n"
    + HTTP-Request-Uri + "\n"
    + Content(Body) + "\n"
    + Date
    

    Building Signature Code Example

    import java.io.UnsupportedEncodingException;
    import javax.crypto.Mac;
    import javax.crypto.spec.SecretKeySpec;
    import org.apache.commons.codec.binary.Base64;
    
    public class SignatureGenerator {
    
        public static String getSignature(String secretKey, String method, String uri, String body, String strDate){
            String toSign = method + "\n"
                    + uri + "\n"
                    + body + "\n"
                    + strDate;
            Mac mac = null;
            try {
                byte[] secretyKeyBytes = secretKey.getBytes("UTF-8");
                SecretKeySpec secretKeySpec = new SecretKeySpec(secretyKeyBytes, "HmacSHA256");
                mac = Mac.getInstance("HmacSHA256");
                mac.init(secretKeySpec);
            } catch (Exception ex) {
                System.out.println(ex);
            }
    
            String signature = null;
            byte[] data;
            byte[] rawHmac;
            try {
                    data = toSign.getBytes("UTF-8");
                    rawHmac = mac.doFinal(data);
                    Base64 encoder = new Base64();
                    signature = new String(encoder.encode(rawHmac));
            } catch (UnsupportedEncodingException e) {
                    throw new RuntimeException("UTF-8 is unsupported!", e);
            }
            return signature;
        }
    
    }
    
    $message = $method."\n"
                    . $endpoint . "\n"
                    . $body . "\n"
                    . $requestDate;
    
    
    $signature = base64_encode(hash_hmac('SHA256', $message, $secretKey, true));
    
    
    using System;
    using System.Security.Cryptography;
    
    namespace Apifon
    {
        class SignatureGenerator
        {
            public static string hmac(string secretKey, string method, string uri, string body, string strDate)
            {
                string toSign = method + "\n"
                        + uri + "\n"
                        + body + "\n"
                        + strDate;
    
                var encoding = new System.Text.UTF8Encoding();
                byte[] keyByte = encoding.GetBytes(secretKey);
                byte[] messageBytes = encoding.GetBytes(toSign);
                using (var hmacsha256 = new HMACSHA256(keyByte))
                {
                    byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
                    return Convert.ToBase64String(hashmessage);
                }
            }
        }
    }
    
    import base64
    import hashlib
    import hmac
    
    
    def sign(method, endpoint, body, request_date, secretKey):
        try:
            signed_message = method + "\n" + endpoint + "\n" + body + "\n" + request_date
            encode = hmac.new(bytes(secretKey.encode("utf-8")), bytes(signed_message.encode("utf-8")), hashlib.sha256).digest()
            signature = base64.b64encode(encode).decode()
            return signature
        except Exception as e:
            print(str(e))
    
    var message = method + "\n"
                 + endpoint + "\n"
                 + body + "\n"
                 + requestDate;
    
    var signature = crypto.createHmac('sha256', secretKey).update(message).digest('base64');
    

    The Signature element is the RFC 2104 HMAC-SHA256 of selected elements from the request, meaning that the Signature part of the Authorization header will vary from request to request. If the request signature calculated by the system matches the Signature included with the request, the requester will have demonstrated possession of the ApifonWS secret access key. The request will then be processed under the identity, and with the authority of the developer to whom the key was issued.

    Following is a pseudogrammar that illustrates the construction of the Authorization request header. (In the example, \n means the Unicode code point U+000A, commonly called newline).

    HMAC-SHA256 is an algorithm defined by RFC 2104 – Keyed-Hashing for Message Authentication . The algorithm takes as input two byte-strings, a key and a message. For ApifonWS request authentication, use your ApifonWS secret access key (YourSecretAccessKeyID) as the key, and the UTF-8 encoding of the StringToSign as the message. The output of HMAC-SHA256 is also a byte string, called the digest. The Signature request parameter is constructed by Base64 encoding this digest.

    Request Canonicalization for Signing

    Recall that when the system receives an authenticated request, it compares the computed request signature to the signature provided by the StringToSign of the request. For that reason, you must compute the signature by using the same method used by ApifonWS. We call the process of putting a request in an agreed-upon form for signing canonicalization.

    String to sign empty Elements

    If a StringToSign element called for in the definition of StringToSign is not present in your request (for example, Content are optional for PUT requests and meaningless for GET requests), substitute the empty string (“”) for that position.

    Time Stamp Requirement

    Building Timestamp Header Code Example

    HttpPost request = new HttpPost();
    
    SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
    dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
    String strDate = dateFormat.format(new Date());
    
    request.setHeader("X-ApifonWS-Date", strDate);
    
    $dateTime = new \DateTime();
    $dateTime->setTimezone(new \DateTimeZone('GMT'));
    $requestDate = $dateTime->format('D, d M Y H:i:s T');
    
    $header[] = "X-ApifonWS-Date: " . $requestDate;
    
    curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
    
    String strDate = DateTime.Now.ToUniversalTime().ToString("r");
    
    WebRequest webRequest = WebRequest.Create(uri);
    
    webRequest.Headers["X-ApifonWS-Date"] = strDate;
    
    request_date = datetime.now(timezone.utc).strftime('%a, %d %b %Y %H:%M:%S GMT')
    
    headers = {
        "X-ApifonWS-Date": request_date
    }
    
    connection = http.client.HTTPConnection(base_url)
    connection.request(method, endpoint, body, headers)
    
    var d = new Date();
    var dateTime = d.toUTCString();
    var requestDate = dateTime;
    
    var request = require('sync-request');
    
    var res = request(method, url, {
        headers: {
            'X-ApifonWS-Date': requestDate
        },
        body: body
    });
    

    A valid time stamp (use only an X-ApifonWS-Date header) is mandatory for authenticated requests. Furthermore, the client timestamp included with an authenticated request must be within 15 minutes of the ApifonWS system time when the request is received. If not, the request will fail with the Unauthorized (or 401 Unauthorized Access) error code. The intention of these restrictions is to limit the possibility that intercepted requests could be replayed by an adversary. For stronger protection against eavesdropping, use the HTTPS transport for authenticated requests.

    You can set the timestamp for the request by using an ‘X-ApifonWS-Date’ header. The value of the X-ApifonWS-Date header must be in one of the RFC 2616 formats (http://www.ietf.org/rfc/rfc2616.txt). See the next section for an example.

    Authentication Examples

    Setting Authorization Header Code Example

    import org.apache.http.client.methods.HttpPost;
    
    HttpPost request = new HttpPost();
    
    request.setHeader("Authorization", "ApifonWS " + token + ":" + signature);
    
    $curl = curl_init($url);
    
    $header[] = "Authorization: ApifonWS " . $token . ":" . $signature;
    
    curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
    
    WebRequest webRequest = WebRequest.Create(uri);
    
    webRequest.Headers["Authorization"] = "ApifonWS " + token + ":" + signature;
    
    headers = {
        "Authorization": "ApifonWS %s: %s" % (token, signature),
    }
    
    connection = http.client.HTTPConnection(base_url)
    connection.request(method, endpoint, body, headers)
    
    var request = require('sync-request');
    
    var res = request(method, url, {
        headers: {
            'Authorization': 'ApifonWS ' + token + ":" + signature,
        },
        body: body
    });
    

    The examples in this section use the (non-working) credentials in the following table.

    Parameter Value Description
    Token 5b5a6ca0deb4bdba5bab An alphanumeric sequence that is used to reference to the user Account a is making the Request.
    Secret Key YourSecretKey A character sequence used to validate the identity of the Requester.

    In the example StringToSign, formatting is not significant, and \n means the Unicode code point U+000A, commonly called newline. Also, the examples use “+0000” to designate the time zone. You can use “GMT” to designate timezone instead, but the signatures shown in the examples will be different.

    Example Object POST

    Request

    Method: POST
    
    Endpoint: /services/sms/send
    
    Content-Type: application/json
    
    Content-Length: 12
    
    Host: ars.apifon.com
    
    X-ApifonWS-Date: Sun, 22 Feb 2016 21:29:42 +0000
    
    Authorization: ApifonWS 5b5a6ca0deb4bdba5bab:YourSecretKey 
    

    StrToSign

    POST \n
    
    /services/sms/send \n
    
    {subscribers:{...}, message:{...}, ...} \n
    
    Sun, 22 Feb 2016 21:29:42 +0000
    

    Complete Request Example

    import java.io.IOException;
    import java.net.URI;
    import java.net.URISyntaxException;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.util.Locale;
    import java.util.TimeZone;
    import org.apache.http.HttpResponse;
    import org.apache.http.client.HttpClient;
    import org.apache.http.client.methods.HttpPost;
    import org.apache.http.entity.StringEntity;
    import org.apache.http.impl.client.HttpClientBuilder;
    
    public class HttpRequest {
    
        public static void main(String[] args) throws URISyntaxException, IOException {
            String token = "5b5a6ca0deb4bdba5bab";
            String secretKey = "YourSecretKey";
            String endpoint = "/services/balance";
            String body = "";
    
            StringEntity input = new StringEntity(body, "UTF-8");
            input.setContentType("application/json");
    
            HttpPost request = new HttpPost();
            request.setEntity(input);
            request.setURI(new URI("https://ars.apifon.com" + endpoint));
    
            SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
            dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
            String strDate = dateFormat.format(new Date());
    
            HttpClient httpClient = HttpClientBuilder.create().build();
            URI tmUri = new URI(endpoint);
    
            String signature = SignatureGenerator.getSignature(secretKey, "POST", tmUri.getPath(), body, strDate);
            request.setHeader("Content-Type", "application/json");
            request.setHeader("Authorization", "ApifonWS " + token + ":" + signature);
            request.setHeader("X-ApifonWS-Date", strDate);
    
            HttpResponse response = httpClient.execute(request);
        }
    }
    
    <?php
    
    $token = "5b5a6ca0deb4bdba5bab";
    $secretKey = "YourSecretKey";
    $endpoint = "/services/balance";
    $body = "";
    $url = "https://ars.apifon.com" . $endpoint;
    
    $dateTime = new \DateTime();
    $dateTime->setTimezone(new \DateTimeZone('GMT'));
    $requestDate = $dateTime->format('D, d M Y H:i:s T');
    
    $message = "POST"."\n"
    . $endpoint . "\n"
    . $body . "\n"
    . $requestDate;
    
    $signature = base64_encode(hash_hmac('SHA256', $message, $secretKey, true));
    
    $header = array();
    $header[] = "Content-type: application/json";
    $header[] = "Authorization: ApifonWS " . $token . ":" . $signature;
    $header[] = "X-ApifonWS-Date: " . $requestDate;
    
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $body);
    
    $response = curl_exec($curl);
    
    using System;
    using System.Security.Cryptography;
    using System.IO;
    using System.Net;
    using System.Text;
    
    namespace Apifon
    {
        class HttpRequest
        {
            static void Main(string[] args)
            {
                String token = "5b5a6ca0deb4bdba5bab";
                String secretKey = "YourSecretKey";
                String body = "";
                String uri = "https://ars.apifon.com/services/balance";
                String strDate = DateTime.Now.ToUniversalTime().ToString("r");
    
                byte[] data = Encoding.UTF8.GetBytes(body);
                WebRequest webRequest = WebRequest.Create(uri);
    
                Uri tmpUri = new Uri(uri);
                webRequest.Method = "POST";
                webRequest.ContentType = "application/json";
                webRequest.ContentLength = data.Length;
                string toSign = "POST" + "\n"
                    + tmpUri.AbsolutePath + "\n"
                    + body + "\n"
                    + strDate;
                string signature;
                var encoding = new UTF8Encoding();
                byte[] messageBytes = encoding.GetBytes(toSign);
                using (var hmacsha256 = new HMACSHA256(encoding.GetBytes(secretKey)))
                {
                    signature = Convert.ToBase64String(hmacsha256.ComputeHash(messageBytes));
                }
                webRequest.Headers["X-ApifonWS-Date"] = strDate;
                webRequest.Headers["Authorization"] = "ApifonWS " + token + ":" + signature;
                using (Stream stream = webRequest.GetRequestStream())
                {
                    stream.Write(data, 0, data.Length);
                }
    
                string responseContent = null;
                using (WebResponse response = webRequest.GetResponse())
                {
                    using (Stream stream = response.GetResponseStream())
                    {
                        using (StreamReader sr99 = new StreamReader(stream))
                        {
                            responseContent = sr99.ReadToEnd();
                        }
                    }
                }
                Console.WriteLine(responseContent);
            }
        }
    }
    
    import json
    import base64
    import hashlib
    import hmac
    import http.client
    from datetime import datetime, timezone
    
    request_date = datetime.now(timezone.utc).strftime('%a, %d %b %Y %H:%M:%S GMT')
    
    token = "5b5a6ca0deb4bdba5bab"
    secretKey = "YourSecretKey"
    uri = "ars.apifon.com"
    endpoint = "/services/balance"
    body = ""
    
    signed_message = "POST" + "\n" + endpoint + "\n" + body + "\n" + request_date
    
    encode = hmac.new(bytes(secretKey.encode("utf-8")), bytes(signed_message.encode("utf-8")), hashlib.sha256).digest()
    signature = base64.b64encode(encode).decode()
    
    headers = {
        "Content-type": "application/json",
        "Authorization": "ApifonWS %s: %s" % (token, signature),
        "X-ApifonWS-Date": request_date
    }
    
    try:
        connection = http.client.HTTPConnection(uri)
        connection.request("POST", endpoint, body, headers)
    except Exception as e:
        print(str(e))
    t = json.loads(connection.getresponse().read().decode('utf8'))
    print(t)
    
    
    var token = "5b5a6ca0deb4bdba5bab";
    var secretKey = "YourSecretKey";
    var endpoint = "/services/balance";
    var body = "";
    var url = "https://ars.apifon.com" + endpoint;
    
    var requestDate = new Date().toUTCString();
    
    var message = "POST" + "\n"
            + endpoint + "\n"
            + body + "\n"
            + requestDate;
    
    const crypto = require('crypto');
    var signature = hmac = crypto.createHmac('sha256', secretKey).update(message).digest('base64');
    
    var request = require('sync-request');
    var res = request("POST", url, {
        headers: {
            'Content-type': 'application/json',
            'Authorization': 'ApifonWS ' + token + ":" + signature,
            'X-ApifonWS-Date': requestDate,
        },
        body: body
    });
    return JSON.parse(res.getBody('utf8'));
    

    This example sends an SMS request with the POST method.

    REST Request Signing Problems

    When REST request authentication fails, the system responds to the request with an 401 Unauthorized Error.

    Some toolkits silently insert headers that you do not know about beforehand, such as adding the header Content-Type during a POST. In most of these cases, the value of the inserted header remains constant, allowing you to discover the missing headers by using tools such as Ethereal or tcpmon.

    Using Base64 Encoding

    HMAC request signatures must be Base64 encoded. Base64 encoding converts the signature into a simple ASCII string that can be attached to the request.

    SMS Gateway REST API

    The SMS REST API provides an interface for sending SMS messages around the world.

    To get started, you need to sign up and login to our platform, where you can create an SMS API key, and use that key within the HTTP headers for every request.

    The SMS REST web service expects a JSON request that defines the message you wish to send. The service replies with a JSON response that acknowledges your request including an identifier for your reference. A callback service is also available that informs you of the delivery status of a message once it has been processed.

    SMS Service Endpoints

    Host URL: https://ars.apifon.com

    Service Endpoint: /services/sms/send

    Content-Type: application/json; charset=utf-8

    HTTP Method: POST

    SMS Request

    The request is encoded in JSON, and is split in several levels. Each table below will represent a level, starting with the outermost one.

    Request Body: Outer Level

    Request headers

    Content-Type: application/json
    X-ApifonWS-Date: Thu, 29 Sep 2016 12:18:56 GMT
    Authorization: ApifonWS 5b5a6ca0deb4bdba5bab:PSd5H7MDLQR3fehj+UYhEXndk0fuS+yPshFHQd6scbY=
    

    Complete SMS Request body

    {
        "subscribers": [{
                "number": "306999999999",
                "custom_id": "222",
                "params": {
                    "apifon_lp": {
                        "url": "https://mookee.apifon.com/user/login/",
                        "data": {
                            "name": "Mr. John"
                        },
                        "redirect": true
                    },
                    "name": "John"
                }
            }
        ],
        "reference_id": "Campaign #215",
        "message": {
            "text": "Hello {name}! {apifon_lp}",
            "dc": 0,
            "sender_id": "Apifon"
        },
        "callback_url": "https://yourserver/callback",
        "tte": "86400",
        "date": "2018-02-06T12:43:23"
    }
    

    Simple SMS Request Body

    {
        "message": {
            "text": "Hello There!",
            "sender_id": "Apifon"
        },
        "subscribers": [{
                "number": "306999999999"
            }
        ]
    }
    

    Code Example

    String body = "{\n" +
                "   \"subscribers\": [{\n" +
                "           \"number\": \"306999999999\",\n" +
                "           \"custom_id\": \"222\",\n" +
                "           \"params\": {\n" +
                "               \"apifon_lp\": {\n" +
                "                   \"url\": \"https://mookee.apifon.com/user/login/\",\n" +
                "                   \"data\": {\n" +
                "                       \"name\": \"Mr. John\"\n" +
                "                   },\n" +
                "                   \"redirect\": true\n" +
                "               },\n" +
                "               \"name\": \"John\"\n" +
                "           }\n" +
                "       }\n" +
                "   ],\n" +
                "   \"reference_id\": \"Campaign #215\",\n" +
                "   \"message\": {\n" +
                "       \"text\": \"Hello {name}! {apifon_lp}\",\n" +
                "       \"dc\": 0,\n" +
                "       \"sender_id\": \"Apifon\"\n" +
                "   },\n" +
                "   \"callback_url\": \"https://yourserver/callback\",\n" +
                "   \"tte\": \"86400\",\n" +
                "   \"date\": \"2018-02-06T12:43:23\"\n" +
                "}";
    
    $body = "{
        \"subscribers\": [{
                \"number\": \"306999999999\",
                \"custom_id\": \"222\",
                \"params\": {
                    \"apifon_lp\": {
                        \"url\": \"https://mookee.apifon.com/user/login/\",
                        \"data\": {
                            \"name\": \"Mr. John\"
                        },
                        \"redirect\": true
                    },
                    \"name\": \"John\"
                }
            }
        ],
        \"reference_id\": \"Campaign #215\",
        \"message\": {
            \"text\": \"Hello {name}! {apifon_lp}\",
            \"dc\": 0,
            \"sender_id\": \"Apifon\"
        },
        \"callback_url\": \"https://yourserver/callback\",
        \"tte\": \"86400\",
        \"date\": \"2018-02-06T12:43:23\"
    }";
    
    String body = "{" +
                    "\"subscribers\": [{" +
                        "\"number\": \"306999999999\"," +
                        "\"custom_id\": \"222\"," +
                        "\"params\": {" +
                            "\"apifon_lp\": {" +
                                "\"url\": \"https://mookee.apifon.com/user/login/\"," +
                                "\"data\": {" +
                                    "\"name\": \"Mr. John\"" +
                                "}," +
                                "\"redirect\": true" +
                            "}," +
                            "\"name\": \"John\"" +
                            "}" +
                        "}" +
                    "]," +
                    "\"reference_id\": \"Campaign #215\"," +
                    "\"message\": {" +
                        "\"text\": \"Hello {name}! {apifon_lp}\"," +
                        "\"dc\": 0," +
                        "\"sender_id\": \"Apifon\"" +
                    "}," +
                    "\"callback_url\": \"https://yourserver/callback\"," +
                    "\"tte\": \"86400\"," +
                    "\"date\": \"2018-02-06T12:43:23\"" +
                "}";
    
    body = """{
        "subscribers": [{
                "number": "306999999999",
                "custom_id": "222",
                "params": {
                    "apifon_lp": {
                        "url": "https://mookee.apifon.com/user/login/",
                        "data": {
                            "name": "Mr. John"
                        },
                        "redirect": true
                    },
                    "name": "John"
                }
            }
        ],
        "reference_id": "Campaign #215",
        "message": {
            "text": "Hello {name}! {apifon_lp}",
            "dc": 0,
            "sender_id": "Apifon"
        },
        "callback_url": "https://yourserver/callback",
        "tte": "86400",
        "date": "2018-02-06T12:43:23"
    }"""
    
    var body = `{
        "subscribers": [{
                "number": "306999999999",
                "custom_id": "222",
                "params": {
                    "apifon_lp": {
                        "url": "https://mookee.apifon.com/user/login/",
                        "data": {
                            "name": "Mr. John"
                        },
                        "redirect": true
                    },
                    "name": "John"
                }
            }
        ],
        "reference_id": "Campaign #215",
        "message": {
            "text": "Hello {name}! {apifon_lp}",
            "dc": 0,
            "sender_id": "Apifon"
        },
        "callback_url": "https://yourserver/callback",
        "tte": "86400",
        "date": "2018-02-06T12:43:23"
    }`;
    
    Key Type Description
    subscribers SUBSCRIBERS* An array of subscriber objects (more info below).
    [SUBSCRIBER_1, SUBSCRIBER_2, …]
    reference_id (*optional) String Include any reference string for your reference. Useful for your internal reports (255 characters max).
    message MESSAGE** Defines the content of your message (more info below).
    callback_url (*optional) String If set, the callback (delivery / status report) will be delivered to this URL, otherwise no callback will take place. Must be a valid URL starting with https://. A valid signed certificate must be used.
    tte (*optional) String If the value inside the string is an integer, then tte is the Validity Period in seconds.

    Otherwise, the value inside the string must be a date with the format “yyyy-MM-dd’T’HH:mm:ss”.

    This sets the length of time, in seconds, for which Apifon will attempt to send the message. Note that this does not guarantee a message will be delivered within the specified time, as not all network operators will honor this value.

    Default (when not supplied, or when set to 0): 8 hours.
    date (*optional) String The date that the message will be sent on UTC/GMT TIMEZONE – if omitted it will be sent immediately.
    Format: "yyyy-MM-dd'T'HH:mm:ss".

    Request Body: SUBSCRIBERS*

    Key Type Description
    number String Mobile number (MSISDN) to deliver the message to. Number is in international format and is only digits between 7-15 digits long. First digit cannot be a 0.
    custom_id (*optional) String ID for the specific subscriber.
    params (*optional) Key-Values If your message content contains placeholders for personalized messages per destination, this field is required to populate the value for each recipient. For further details, see the MESSAGE** table in the next page. This field can also contain a landing page for the specific subscriber, using the key "apifon_lp" and a LANDING object as a value.

    Request Body: MESSAGE**

    Key Type Description
    text String Contains the body of the SMS message to be delivered to the destination device. One can optionally specify keys within the message body that will be replaced later with values given by the params field in the SUBSCRIBERS* object. See 'params' in the SUBSCRIBERS* section for more information on supplying the value for these keys. Each placeholder must be specified as {KEY}, where KEY is a key name in the params list. For this feature to be used, GSM7 or UCS2 encoding must be used.

    In the event your text is longer than 160 characters in 7bit, 140 in 8bit or 70 in 16bit, Apifon will split the message into parts. In that case, the response will tell you how many parts the message has been sent in. If a LANDING page is defined, {apifon_lp} will be replaced with the url parameter of the landing object.
    dc (*optional) Data coding Contains the information on how the text is encoded. Defaults to ‘0’. It can only be a number in the rand [0-2].The maximum number of characters you can fit into a single message depends on the encoding you are using:

    [0]: GSM7 bit Default Alphabet (160).
    Basic Latin subset of ASCII, as well as some characters of the ISO Latin 1 – 160

    [1]: GSM 8-bit data encoding (140).
    8-bit data encoding mode treats the information as raw data. According to the standard, the alphabet for this encoding is user-specific.

    [2]: UCS-2 (UTF-16 [16 bit]) Encoding (70).
    This encoding allows use of a greater range of characters and languages. UCS-2 can represent the most commonly used Latin and eastern characters at the cost of a greater space expense.
    sender_id String The sender ID (a.k.a. from) for the SMS delivery.
    If numeric, minimum length is 1, maximum length is 16 digits.
    If alphanumeric, minimum length is 1, maximum length is 11 characters.

    Request Body: LANDING PAGE***

    Key Type Description
    url String The url or the template ID of the given landing page.
    data (*optional) Key-Values If the landing page content contains placeholders for personalized pages per destination, this field is required to populate the value for each recipient.
    redirect (*optional) Boolean A flag determining if the shortened url will redirect to the landing page url. By default redirect is set to true.
    method (*optional) Enum The http method that shortened url will use to direct to the landing page url. Set value only if redirect is set to false.

    ["GET"]: The short url will direct to the landing page url using a GET request.
    ["POST"]: The short url will direct to the landing page url using a POST request.
    prevent_sys_params (*optional) Boolean A flag determining if the System Parameters will be forwarded to URL as Query Parameters. By default prevent_sys_params is set to false.
    landing_domain (*optional) String If set, your domain will be used instead of Apifon's landing domain http://apfn.eu. Must be a valid URL, starting with http:// or https://.

    SMS Response

    After submitting a request using Apifon API, you will receive an HTTP response and a delivery receipt to your submitted Callback URL (if you have indicated one on your request). The HTTP response will contain a JSON object. The actual delivery status of the message is only confirmed by the delivery receipt.

    JSON Response

    Response body

    {
      "request_id": "eff655d8-0cb6-47b3-8828-96e1b80b55af",
      "reference": "Campaign #215",
      "results": {
        "306999999999": [{
            "message_id": "e2d4424d-7d6a-49c2-b564-99b2b68c74cb",
            "custom_id": "222",
            "length": 11,
            "short_code": null,
            "short_url": null
          }
        ]
      },
      "result_info": {
        "status_code": 200,
        "description": "OK"
      }
    }
    
    Key Type Description
    request_id String A generated id for the given request.
    reference String Whatever the user passed into reference_id.
    results Hashmap < String, RESULT_DETAILS > A hashmap with the results for every subscriber. The map key is the subscriber number and the value for any entry is an array of detail objects.
    result_info RESULT_INFO A summary of the status of the request.

    JSON Response: RESULT_DETAILS

    Key Type Description
    message_id String A generated id for the new message.
    custom_id String The custom id that the user gave.
    length Int The number of characters that the message contains.
    short_url String It contains the shortened version of the url, if the request contained a landing page.
    short_code String It contains the generated shortened code used by the short_url.

    JSON Response: RESULT_INFO

    Key Type Description
    status_code String A status code for the given request that follows the http standards ( 200 if OK, 403 if parameters are wrong, 401 if authentication error).
    description String A human friendly message that describes the status code.

    SMS Reply Callback

    Reply Callback

    {
        "message_id": "d5a53b51-dc57-4c2c-b880-36f788c4d4d4",
        "from": "306999999999",
        "to": "306988888888",
        "text": "This is my reply.",
        "timestamp": 1481126247,
        "type": "SMS"
    }
    

    HTTP Method: POST

    Content-Type: application/json; charset=utf-8

    When a subscriber responds on a 2-way message, a callback is generated and signaled back to the client using an HTTP callback. The request generated to this URL is described here. The endpoint on the client side must fully support this kind of request and respond accordingly. In case of delivery failure, the callback will be resent two more time with a two minute gap.

    Key Type Description
    message_id String A generated id for the new message.
    from String The number of the subscriber.
    to String The sender id of the original message request.
    text String Contains the body of the subscriber's response.
    timestamp int The timestamp the message arrived.
    type String The type of the channel the subscriber used to create the reply.

    Delete Scheduled SMS

    The deletion service can be used to remove scheduled SMSs.

    Host URL: https://ars.apifon.com

    Service Endpoint: /services/sms/remove

    Content-Type: application/json; charset=utf-8

    HTTP Method: POST

    Request

    Request headers

    Content-Type: application/json
    X-ApifonWS-Date: Thu, 29 Sep 2016 12:18:57 GMT
    Authorization: ApifonWS 5b5a6ca0deb4bdba5bab:VSkkiWuLRULd3eE/HoiU2CFvyvcqW31R2tU3kqqPsbE=
    

    Request body

    {
     "id": "adbfbe48-82e7-49d5-af1a-e5b284cf5bf3",
     "field": "REQUEST_ID"
    }
    

    The request object consists of two keys, the field and the id, as explained in the following table.

    Key Type Description
    field String We can delete messages based on their request id and their reference id. So if you want to delete using the request id then the field must be equal to “REQUEST_ID”, otherwise the field must be equal to “REFERENCE_ID”.
    id String The value of the field.

    Response

    Response body

    4
    

    Code Example

    String body = "{\n" +
                " \"id\": \"adbfbe48-82e7-49d5-af1a-e5b284cf5bf3\",\n" +
                " \"field\": \"REQUEST_ID\"\n" +
                "}";
    
    $body = "{
             \"id\": \"adbfbe48-82e7-49d5-af1a-e5b284cf5bf3\",
             \"field\": \"REQUEST_ID\"
            }";
    
    String body = "{" +
                    "\"id\": \"adbfbe48-82e7-49d5-af1a-e5b284cf5bf3\"," +
                    "\"field\": \"REQUEST_ID\"" +
                "}";
    
    body = """{
             "id": "adbfbe48-82e7-49d5-af1a-e5b284cf5bf3",
             "field": "REQUEST_ID"
            }"""
    
    var body = `{
        "id": "adbfbe48-82e7-49d5-af1a-e5b284cf5bf3",
        "field": "REQUEST_ID"
       }`;
    

    The response is an integer that shows the number of the deleted messages.

    IM Gateway REST API

    The IM REST API provides an interface for sending IM and SMS messages around the world.

    To get started, you need to login to our members section to create an authentication IM token API key, and use that token key within the HTTP headers for every request.

    The IM REST web service expects a JSON request that defines the message you wish to send. Your request may include your routing preference, be it lowest cost or feature-first. The service replies with a JSON response that acknowledges your request including an identifier for your reference. A callback service is also available that informs you of the delivery status of a message once it has been processed.

    Functionality offered by the platform includes the ability to send text, images, action buttons via IM, receive replies from recipients via 2-way messaging, and automatically fall-back on SMS if IM delivery is not possible.

    IM Service Endpoints

    Host URL: https://ars.apifon.com

    Service Endpoint: /services/im/send

    Content-Type: application/json; charset=utf-8

    HTTP Method: POST

    IM Request

    The request is encoded in JSON, and is split in several levels. Each table below will represent a level, starting with the outermost one.

    OUTER LEVEL

    Request headers

    Content-Type: application/json
    X-ApifonWS-Date: Thu, 29 Sep 2016 12:18:56 GMT
    Authorization: ApifonWS 5b5a6ca0deb4bdba5bab:PSd5H7MDLQR3fehj+UYhEXndk0fuS+yPshFHQd6scbY=
    

    Complete IM Request body

    {
      "subscribers": [{
          "number": "306999999999",
          "custom_id": "222",
          "params": {
            "apifon_lp": {
              "url": "https://mookee.apifon.com/user/login/",
              "data": {
                "name": "John"
              },
              "redirect": true,
              "method": "GET"
            },
            "name": "John"
          }
        }
      ],
      "reference_id": "Campaign #216",
      "message": {
        "text": "Hello {name}! {apifon_lp}",
        "dc": 0,
        "sender_id": "Apifon"
      },
      "callback_url": "https://yourserver/callback",
      "reply_url": "https://yourserver/reply",
      "im_channels": [{
          "id": "channelID",
          "sender_id": "Mookee",
          "text": "{name}! 50% discount on our membership fee if you renew your subscription today!",
          "images": ["http://assets.apifon.com/images/boy_girl.jpg"],
          "actions": [{
              "title": "Renew now!",
              "target_url": "https://www.apifon.com"
            }
          ],
          "ttl": 86400,
          "expiry_text": "Message Expired!!"
        }
      ],
      "date": "2018-02-06T13:18:25"
    }
    

    Simple IM Request Body

    {
        "message": {},
        "callback_url": "https://yourserver/callback",
        "im_channels": [{
                "sender_id": "Mookee",
                "text": "50% discount on our membership fee if you renew your subscription today!"
            }
        ],
        "subscribers": [{
                "number": "306999999999"
            }
        ]
    }
    

    Code Example

    String body = "{\n" +
                "  \"subscribers\": [{\n" +
                "      \"number\": \"306999999999\",\n" +
                "      \"custom_id\": \"222\",\n" +
                "      \"params\": {\n" +
                "        \"apifon_lp\": {\n" +
                "          \"url\": \"https://mookee.apifon.com/user/login/\",\n" +
                "          \"data\": {\n" +
                "            \"name\": \"John\"\n" +
                "          },\n" +
                "          \"redirect\": true,\n" +
                "          \"method\": \"GET\"\n" +
                "        },\n" +
                "        \"name\": \"John\"\n" +
                "      }\n" +
                "    }\n" +
                "  ],\n" +
                "  \"reference_id\": \"Campaign #216\",\n" +
                "  \"message\": {\n" +
                "    \"text\": \"Hello {name}! {apifon_lp}\",\n" +
                "    \"dc\": 0,\n" +
                "    \"sender_id\": \"Apifon\"\n" +
                "  },\n" +
                "  \"callback_url\": \"https://yourserver/callback\",\n" +
                "  \"reply_url\": \"https://yourserver/reply\",\n" +
                "  \"im_channels\": [{\n" +
                "      \"id\": \"channelID\",\n" +
                "      \"sender_id\": \"Mookee\",\n" +
                "      \"text\": \"{name}! 50% discount on our membership fee if you renew your subscription today!\",\n" +
                "      \"images\": [\"http://assets.apifon.com/images/boy_girl.jpg\"],\n" +
                "      \"actions\": [{\n" +
                "          \"title\": \"Renew now!\",\n" +
                "          \"target_url\": \"https://www.apifon.com\"\n" +
                "        }\n" +
                "      ],\n" +
                "      \"ttl\": 86400,\n" +
                "      \"expiry_text\": \"Message Expired!!\"\n" +
                "    }\n" +
                "  ],\n" +
                "  \"date\": \"2018-02-06T13:18:25\"\n" +
                "}";
    
    $body = "{
      \"subscribers\": [{
          \"number\": \"306999999999\",
          \"custom_id\": \"222\",
          \"params\": {
            \"apifon_lp\": {
              \"url\": \"https://mookee.apifon.com/user/login/\",
              \"data\": {
                \"name\": \"John\"
              },
              \"redirect\": true,
              \"method\": \"GET\"
            },
            \"name\": \"John\"
          }
        }
      ],
      \"reference_id\": \"Campaign #216\",
      \"message\": {
        \"text\": \"Hello {name}! {apifon_lp}\",
        \"dc\": 0,
        \"sender_id\": \"Apifon\"
      },
      \"callback_url\": \"https://yourserver/callback\",
      \"reply_url\": \"https://yourserver/reply\",
      \"im_channels\": [{
          \"id\": \"channelID\",
          \"sender_id\": \"Mookee\",
          \"text\": \"{name}! 50% discount on our membership fee if you renew your subscription today!\",
          \"images\": [\"http://assets.apifon.com/images/boy_girl.jpg\"],
          \"actions\": [{
              \"title\": \"Renew now!\",
              \"target_url\": \"https://www.apifon.com\"
            }
          ],
          \"ttl\": 86400,
          \"expiry_text\": \"Message Expired!!\"
        }
      ],
      \"date\": \"2018-02-06T13:18:25\"
    }";
    
    String body = "{" +
                    "\"subscribers\": [{" +
                        "\"number\": \"306999999999\"," +
                        "\"custom_id\": \"222\"," +
                        "\"params\": {" +
                            "\"apifon_lp\": {" +
                                "\"url\": \"https://mookee.apifon.com/user/login/\"," +
                                "\"data\": {" +
                                    "\"name\": \"John\"" +
                                "}," +
                                "\"redirect\": true," +
                                "\"method\": \"GET\"" +
                            "}," +
                            "\"name\": \"John\"" +
                        "}" +
                    "}]," +
                    "\"reference_id\": \"Campaign #216\"," +
                    "\"message\": {" +
                        "\"text\": \"Hello {name}! {apifon_lp}\"," +
                        "\"dc\": 0," +
                        "\"sender_id\": \"Apifon\"" +
                    "}," +
                    "\"callback_url\": \"https://yourserver/callback\"," +
                    "\"reply_url\": \"https://yourserver/reply\"," +
                    "\"im_channels\": [{" +
                        "\"id\": \"channelID\"," +
                        "\"sender_id\": \"Mookee\"," +
                        "\"text\": \"{name}! 50% discount on our membership fee if you renew your subscription today!\"," +
                        "\"images\": [\"http://assets.apifon.com/images/boy_girl.jpg\"]," +
                        "\"actions\": [{" +
                            "\"title\": \"Renew now!\"," +
                            "\"target_url\": \"https://www.apifon.com\"" +
                        "}]," +
                        "\"ttl\": 86400," +
                        "\"expiry_text\": \"Message Expired!!\"" +
                    "}]," +
                    "\"date\": \"2018-02-06T13:18:25\"" +
                "}";
    
    body = """{
      "subscribers": [{
          "number": "306999999999",
          "custom_id": "222",
          "params": {
            "apifon_lp": {
              "url": "https://mookee.apifon.com/user/login/",
              "data": {
                "name": "John"
              },
              "redirect": true,
              "method": "GET"
            },
            "name": "John"
          }
        }
      ],
      "reference_id": "Campaign #216",
      "message": {
        "text": "Hello {name}! {apifon_lp}",
        "dc": 0,
        "sender_id": "Apifon"
      },
      "callback_url": "https://yourserver/callback",
      "reply_url": "https://yourserver/reply",
      "im_channels": [{
          "id": "channelID",
          "sender_id": "Mookee",
          "text": "{name}! 50% discount on our membership fee if you renew your subscription today!",
          "images": ["http://assets.apifon.com/images/boy_girl.jpg"],
          "actions": [{
              "title": "Renew now!",
              "target_url": "https://www.apifon.com"
            }
          ],
          "ttl": 86400,
          "expiry_text": "Message Expired!!"
        }
      ],
      "date": "2018-02-06T13:18:25"
    }"""
    
    var body = `{
        "subscribers": [{
            "number": "306999999999",
            "custom_id": "222",
            "params": {
              "apifon_lp": {
                "url": "https://mookee.apifon.com/user/login/",
                "data": {
                  "name": "John"
                },
                "redirect": true,
                "method": "GET"
              },
              "name": "John"
            }
          }
        ],
        "reference_id": "Campaign #216",
        "message": {
          "text": "Hello {name}! {apifon_lp}",
          "dc": 0,
          "sender_id": "Apifon"
        },
        "callback_url": "https://yourserver/callback",
        "reply_url": "https://yourserver/reply",
        "im_channels": [{
            "id": "channelID",
            "sender_id": "Mookee",
            "text": "{name}! 50% discount on our membership fee if you renew your subscription today!",
            "images": ["http://assets.apifon.com/images/boy_girl.jpg"],
            "actions": [{
                "title": "Renew now!",
                "target_url": "https://www.apifon.com"
              }
            ],
            "ttl": 86400,
            "expiry_text": "Message Expired!!"
          }
        ],
        "date": "2018-02-06T13:18:25"
      }`;
    
    Key Type Description
    subscribers SUBSCRIBERS* An array of subscriber objects (more info below).
    [SUBSCRIBER_1, SUBSCRIBER_2, …]
    reference_id (*optional) String Include any reference string for your reference. Useful for your internal reports (255 characters max).
    message (*optional) MESSAGE** If Viber delivery fails, this message will be sent as SMS instead.
    callback_url (*optional) String If set, the callback (delivery / status report) will be delivered to this URL, otherwise no callback will take place. Must be a valid URL starting with https://. A valid signed certificate must be used.
    reply_url (*optional) String If set, any replies sent by the recipient of this message will generate a message-reply callback that will be delivered to the URL given by this field. In order to use this feature, 2-way messaging must be enabled on the Sender ID specified in this message. To enable 2-way messaging on a sender ID, please login to the control panel on our platform, or ask for assistance. Must be a valid URL starting with https://, meaning that a valid signed certificate must be used. You can view the callbacks in this section.
    im_channels Array [IMChannel****] Array of various IM channels that will be used to send the message.
    [IMChannel_1, IMChannel_2, …]
    date (*optional) String The date that the message will be sent on UTC/GMT TIMEZONE – if omitted it will be sent immediately.
    Format: "yyyy-MM-dd'T'HH:mm:ss".

    SUBSCRIBERS*

    Key Type Description
    number String Mobile number (MSISDN) to deliver the message to. Number is in international format and is only digits between 7-15 digits long. First digit cannot be a 0.
    custom_id (*optional) String ID for the specific subscriber
    params (*optional) Key-Values If your message content contains placeholders for personalized messages per destination, this field is required to populate the value for each recipient. For further details, see the MESSAGE** table in the next page. This field can also contain a landing page for the specific subscriber, using the key "apifon_lp" and a LANDING object as a value.

    MESSAGE**

    Key Type Description
    text String Contains the body of the SMS message to be delivered to the destination device. One can optionally specify keys within the message body that will be replaced later with values given by the params field in the SUBSCRIBERS* object. See ‘params’ in the SUBSCRIBERS* section for more information on supplying the value for these keys. Each placeholder must be specified as {KEY}, where KEY is a key name in the params list. For this feature to be used, GSM7 or UCS2 encoding must be used.

    In the event your text is longer than 160 characters in 7bit, 140 in 8bit or 70 in 16bit, Apifon will split the message into parts. In that case, the response will tell you how many parts the message has been sent in. If a LANDING page is defined, {apifon_lp} will be replaced with the url parameter of the landing object.
    dc (*optional) Data coding Contains the information on how the text is encoded. Defaults to ‘0’. It can only be a number in the rand [0-2]. The maximum number of characters you can fit into a single message depends on the encoding you are using:

    [0]: GSM7 bit Default Alphabet (160).
    Basic Latin subset of ASCII, as well as some characters of the ISO Latin 1 – 160

    [1]: GSM 8-bit data encoding (140).
    8-bit data encoding mode treats the information as raw data. According to the standard, the alphabet for this encoding is user-specific.

    [2]: UCS-2 (UTF-16 [16 bit]) Encoding (70).
    This encoding allows use of a greater range of characters and languages. UCS-2 can represent the most commonly used Latin and eastern characters at the cost of a greater space expense.
    sender_id String The sender ID (a.k.a. from) for the SMS delivery.
    If numeric, minimum length is 1, maximum length is 16 digits.
    If alphanumeric, minimum length is 1, maximum length is 11 characters.

    Request Body: LANDING PAGE***

    Key Type Description
    url String The url or the template ID of the given landing page.
    data (*optional) Key-Values If the landing page content contains placeholders for personalized pages per destination, this field is required to populate the value for each recipient.
    redirect (*optional) Boolean A flag determining if the shortened url will redirect to the landing page url. By default redirect is set to true.
    method (*optional) Enum The http method that shortened url will use to direct to the landing page url. Set value only if redirect is set to false.

    ["GET"]: The short url will direct to the landing page url using a GET request.
    ["POST"]: The short url will direct to the landing page url using a POST request.
    prevent_sys_params (*optional) Boolean A flag determining if the System Parameters will be forwarded to URL as Query Parameters. By default prevent_sys_params is set to false.
    landing_domain (*optional) String If set, your domain will be used instead of Apifon's landing domain http://apfn.eu. Must be a valid URL, starting with http:// or https://.

    IMChannel****

    Key Type Description
    id (*optional) String The channel id. If id is not set, the channel ID defined in the token provided is used.
    sender_id (*optional) String The sender id. If sender_id is not set, the sender_id defined in the token provided is used.
    text (*conditional) String The message content. If a LANDING page is defined, {apifon_lp} will be replaced with the url parameter of the landing object.
    images (*conditional) Array Array of objects containing the images of the IM message to send, if message includes images. For Viber, the maximum size of the array is 1, as only one image is supported per message.
    actions (*conditional) Array [IM_ACTION*****] Array of objects describing the action buttons of the IM message to send. For Viber, the maximum size of the array is 1, as only one button is supported per message.
    ttl (*optional) IntVal Time to live.
    The minimum value is 15 (seconds), while the maximum value is 86400 (24 hours).
    expiry_text (*optional) String If the message gets delivered after ttl has passed, then this text will appear instead.

    IM_ACTION*****

    Key Type Description
    title String The caption text to display on the button.
    target_url String The HTTP URL that will be called on the click event for this action. If a LANDING page is defined, {apifon_lp} will be replaced with the url parameter of the landing object.

    Conditional Note

    The IMChannel content must follow one of the following patterns:

    Content Type Description
    Text Transactional An IM message is send containing only a text message.
    Image Promotional An IM message is send containing only an image.
    Text & Action Promotional An IM message is send containing a text message and an Action content.
    Text & Image & Action Promotional An IM message is send containing a text message, and image and an Action content.

    IM Response

    When responding, the REST API will make use of the appropriate and relevant HTTP status code to describe the nature of the result. For non-200 response codes, not all of the fields described in Outer Response, RESULT Item, and RESULT_DETAIL Item might be present.

    View the response codes here.

    After submitting a request using Apifon API, you will receive an HTTP response and a delivery receipt to your submitted Callback URL (if you have indicated one on your request). The HTTP response will contain a JSON object. The actual delivery status of the message is only confirmed by the delivery receipt.

    JSON response

    Response body

    {
      "request_id": "ccb9111f-9ea0-4e01-882f-f72ee502e779",
      "reference": "Campaign #216",
      "results": {
        "306999999999": [{
            "message_id": "6f3f5441-391f-473d-b822-cfb129f21238",
            "custom_id": "222",
            "length": 80,
            "short_code": "2ca6p9",
            "short_url": "http://apfn.eu/2ca6p9"
          }
        ]
      },
      "result_info": {
        "status_code": 200,
        "description": "OK"
      }
    }
    
    Key Type Description
    request_id String A generated id for the given request.
    reference String Whatever the user passed into reference_id
    results Hashmap < String, RESULT_DETAILS > A hashmap with the results for every subscriber. The map key is the subscriber number and the value for any entry is an array of detail objects.
    result_info RESULT_INFO A summary of the status of the request.

    RESULT_DETAILS

    Key Type Description
    message_id String A generated id for the new message.
    custom_id String The custom id that the user gave.
    length Int The number of characters that the message contains.
    short_url String It contains the shortened version of the url, if the request contained a landing page or an action button.
    short_code String It contains the generated shortened code used by the short_url.

    RESULT_INFO

    Key Type Description
    status_code String A status code for the given request that follows the http standards ( 200 if OK, 403 if parameters are wrong, 401 if authentication error).
    description String A human friendly message that describes the status code.

    IM Reply Callback

    Reply Callback

    {
        "channel": "VIBER",
        "reply": {
            "reply_message_id": "d5a53b51-dc57-4c2c-b880-36f788c4d4d4",
            "from": "306999999999",
            "to": "306988888888",
            "timestamp": 1481126247,
            "price": 0.05,
            "message": {
                "text": "This is my reply."
            }
        },
        "original_im": {
            "message_id": "6f3f5441-391f-473d-b822-cfb129f21238",
            "request_id": "ccb9111f-9ea0-4e01-882f-f72ee502e779",
            "reference_id": "My Reference"
        }
    }
    

    HTTP Method: POST

    Content-Type: application/json; charset=utf-8

    When a subscriber responds on a 2-way message, a callback is generated and signaled back to the client using an HTTP callback. The URL invoked is obtained from the “reply_url” field in the original message request. The request generated to this URL is described here. The endpoint on the client side must fully support this kind of request and respond accordingly. In case of delivery failure, the callback will be resend two more times with a two minute gap.

    Key Type Description
    channel String The channel the subscriber used to create the reply.
    reply Reply A summary of the reply message.
    original_im Original IM A summary of the original message.

    Reply

    Key Type Description
    reply_message_id String A generated id for the new reply message.
    from String Subscriber's mobile number.
    to String The sender id of the original message request.
    timestamp int The timestamp the reply message arrived.
    price double The cost of the reply message.
    message Message A summary of the message content.

    Message

    Key Type Description
    text String Contains the body of the subscriber's response.

    Original IM

    Key Type Description
    message_id String The generated id for the given request.
    request_id String The generated id for the given message.
    reference_id String Whatever the user passed into reference_id.

    Delete Scheduled IM

    The deletion service can be used to remove scheduled IMs.

    Host URL: https://ars.apifon.com

    Service Endpoint: /services/im/remove

    Content-Type: application/json; charset=utf-8

    HTTP Method: POST

    Request

    Request headers

    Content-Type: application/json
    X-ApifonWS-Date: Thu, 29 Sep 2016 12:18:57 GMT
    Authorization: ApifonWS 5b5a6ca0deb4bdba5bab:VSkkiWuLRULd3eE/HoiU2CFvyvcqW31R2tU3kqqPsbE=
    

    Request body

    {
     "id": "adbfbe48-82e7-49d5-af1a-e5b284cf5bf3",
     "field": "REQUEST_ID"
    }
    

    The request object consists of two keys, the field and the id, as explained in the following table.

    Key Type Description
    field String We can delete messages based on their request id and their reference id. So if you want to delete using the request id then the field must be equal to “REQUEST_ID”, otherwise the field must be equal to “REFERENCE_ID”.
    id String The value of the field.

    Response

    Response body

    4
    

    Code Example

    String body = "{\n" +
                " \"id\": \"adbfbe48-82e7-49d5-af1a-e5b284cf5bf3\",\n" +
                " \"field\": \"REQUEST_ID\"\n" +
                "}";
    
    $body = "{
             \"id\": \"adbfbe48-82e7-49d5-af1a-e5b284cf5bf3\",
             \"field\": \"REQUEST_ID\"
            }";
    
    String body = "{" +
                    "\"id\": \"adbfbe48-82e7-49d5-af1a-e5b284cf5bf3\"," +
                    "\"field\": \"REQUEST_ID\"" +
                "}";
    
    body = """{
             "id": "adbfbe48-82e7-49d5-af1a-e5b284cf5bf3",
             "field": "REQUEST_ID"
            }"""
    
    var body = `{
        "id": "adbfbe48-82e7-49d5-af1a-e5b284cf5bf3",
        "field": "REQUEST_ID"
       }`;
    

    The response is an integer that shows the number of the deleted messages.

    OTP Gateway REST API

    The OTP REST API provides an interface for sending OTP messages around the world.

    To get started, you need to login to our members section to create an authentication OTP token API key, and use that token key within the HTTP headers for every request.

    The OTP REST web service expects a JSON request that defines the message you wish to send. The service replies with a JSON response that acknowledges your request including an identifier for your reference. A callback service is also available that informs you of the delivery status of a message once it has been processed.

    OTP Service Endpoints

    Host URL: https://ars.apifon.com

    Service Endpoint: /services/otp/create

    Content-Type: application/json; charset=utf-8

    HTTP Method: POST

    OTP Request

    Sending an OTP Request will generate an one time password for the specific subscriber. This one time password will be sent to the subscriber via an SMS. The reference_id that you are including to the request is interconnected with the generated OTP.

    The request is encoded in JSON, and is split in several levels. Each table below will represent a level, starting with the outermost one.

    Request Body: Outer Level

    Request headers

    Content-Type: application/json
    X-ApifonWS-Date: Thu, 29 Sep 2016 12:18:56 GMT
    Authorization: ApifonWS 5b5a6ca0deb4bdba5bab:PSd5H7MDLQR3fehj+UYhEXndk0fuS+yPshFHQd6scbY=
    

    Complete Request body

    {
        "reference_id": "OTP-944706",
        "subscriber": "306999999999",
        "code_length": 6,
        "code_type": "numeric",
        "callback_url": "https://yourserver/callback",
        "expire": 300,
        "message": {
            "text": "Hello There! Here is your OTP: {apifon_otp}",
            "dc": 0,
            "sender_id": "Apifon"
        }
    }
    

    Simple Request body

    {
        "reference_id": "OTP-337",
        "subscriber": "306999999999"
    }
    

    Code Example

    String body = "{\n" +
                "    \"reference_id\": \"OTP-337\",\n" +
                "    \"subscriber\": \"306999999999\",\n" +
                "    \"code_length\": 6,\n" +
                "    \"code_type\": \"numeric\",\n" +
                "    \"callback_url\": \"https://yourserver/callback\",\n" +
                "    \"expire\": 300,\n" +
                "    \"message\": {\n" +
                "        \"text\": \"Hello There! Here is your OTP: {apifon_otp}\",\n" +
                "        \"dc\": 0,\n" +
                "        \"sender_id\": \"Apifon\"\n" +
                "    }\n" +
                "}";
    
    $body = "{
        \"reference_id\": \"OTP-337\",
        \"subscriber\": \"306999999999\",
        \"code_length\": 6,
        \"code_type\": \"numeric\",
        \"callback_url\": \"https://yourserver/callback\",
        \"expire\": 300,
        \"message\": {
            \"text\": \"Hello There! Here is your OTP: {apifon_otp}\",
            \"dc\": 0,
            \"sender_id\": \"Apifon\"
        }
    }";
    
    String body = "{" +
                    "\"reference_id\": \"OTP-337\"," +
                    "\"subscriber\": \"306999999999\"," +
                    "\"code_length\": 6," +
                    "\"code_type\": \"numeric\"," +
                    "\"callback_url\": \"https://yourserver/callback\"," +
                    "\"expire\": 300," +
                    "\"message\": {" +
                        "\"text\": \"Hello There! Here is your OTP: {apifon_otp}\"," +
                        "\"dc\": 0," +
                        "\"sender_id\": \"Apifon\"" +
                    "}" +
                "}";
    
    body = """{
        "reference_id": "OTP-337",
        "subscriber": "306999999999",
        "code_length": 6,
        "code_type": "numeric",
        "callback_url": "https://yourserver/callback",
        "expire": 300,
        "message": {
            "text": "Hello There! Here is your OTP: {apifon_otp}",
            "dc": 0,
            "sender_id": "Apifon"
        }
    }"""
    
    var body = `{
        "reference_id": "OTP-337",
        "subscriber": "306999999999",
        "code_length": 6,
        "code_type": "numeric",
        "callback_url": "https://yourserver/callback",
        "expire": 300,
        "message": {
            "text": "Hello There! Here is your OTP: {apifon_otp}",
            "dc": 0,
            "sender_id": "Apifon"
        }
    }`;
    
    Key Type Description
    reference_id String Include a reference string that will be interconnected with the generated OTP.
    subscriber String Mobile number (MSISDN) to deliver the message to. Number is in international format and is only digits between 7-15 digits long. First digit cannot be a 0.
    code_length (*optional) int Defines the length of the generated OTP. If not set, by default the OTP length is 6 characters.
    code_type (*optional) CodeType Defines the type of the generated OTP.

    ["numeric"]: The OTP will contain only numeric characters.
    ["alpha"]: The OTP will contain only alphabetical characters.
    ["alphanumeric"]: The OTP will contain only alphanumeric characters.

    By default it's value is "numeric".
    callback_url (*optional) String If set, the callback (delivery / status report) will be delivered to this URL, otherwise no callback will take place. Must be a valid URL starting with https://. A valid signed certificate must be used.
    expire (*optional) int Defines the expiration time of the OTP. If not set, by default it will be 300 (in seconds).
    message (*optional) MESSAGE* Defines the content of your message (more info below). If not set, by default it will send an SMS containing only the generated OTP.

    Request Body: MESSAGE*

    Key Type Description
    text String Contains the body of the SMS message to be delivered to the destination device. One can optionally specify {apifon_otp} within the message body that will be replaced later with the generated One Time Password.

    In the event your text is longer than 160 characters in 7bit, 140 in 8bit or 70 in 16bit, Apifon will split the message into parts. In that case, the response will tell you how many parts the message has been sent in.
    dc Data coding Contains the information on how the text is encoded. Defaults to ‘0’. It can only be a number in the rand [0-2].The maximum number of characters you can fit into a single message depends on the encoding you are using:

    [0]: GSM7 bit Default Alphabet (160).
    Basic Latin subset of ASCII, as well as some characters of the ISO Latin 1 – 160

    [1]: GSM 8-bit data encoding (140).
    8-bit data encoding mode treats the information as raw data. According to the standard, the alphabet for this encoding is user-specific.

    [2]: UCS-2 (UTF-16 [16 bit]) Encoding (70).
    This encoding allows use of a greater range of characters and languages. UCS-2 can represent the most commonly used Latin and eastern characters at the cost of a greater space expense.
    sender_id String The sender ID (a.k.a. from) for the SMS delivery.
    If numeric, minimum length is 1, maximum length is 16 digits.
    If alphanumeric, minimum length is 1, maximum length is 11 characters.

    OTP Response

    After submitting a request using Apifon API, you will receive an HTTP response and a delivery receipt to your submitted Callback URL (if you have indicated one on your request). The HTTP response will contain a JSON object. The actual delivery status of the message is only confirmed by the delivery receipt.

    JSON Response

    Response body

    {
        "request_id": "fc4a9c38-faed-42c3-affb-93571e9a8e36",
        "reference_id": "OTP-944706",
        "result": [{
                "message_id": "1c4ecbb0-f6db-44a3-95e9-8a581f1b48cd",
                "custom_id": null,
                "length": 37,
                "short_code": null,
                "short_url": null
            }
        ],
        "result_info": {
            "status_code": 200,
            "description": "OK"
        }
    }
    
    
    Key Type Description
    request_id String A generated id for the given request.
    reference_id String Whatever the user passed into reference_id. You will need this later on in order to validate the generated OTP.
    result List< RESULT_DETAILS > A list with the results of the subscriber. This list will contain more than one RESULT_DETAILS in case the text was too long and had to be split into more than one SMS.
    result_info RESULT_INFO A summary of the status of the request.

    JSON Response: RESULT_DETAILS

    Key Type Description
    message_id String A generated id for the new message.
    length Int The number of characters that the message contains.

    JSON Response: RESULT_INFO

    Key Type Description
    status_code String A status code for the given request that follows the http standards ( 200 if OK, 403 if parameters are wrong, 401 if authentication error).
    description String A human friendly message that describes the status code.

    OTP Verification

    The verification service can be used to make sure than the OTP submitted by the user is correct and has not expired. You need to provide the OTP submitted by the user to your system and the reference_id that was used to generate the OTP.

    Host URL: https://ars.apifon.com

    Service Endpoint: /services/otp/verify/{reference_id}/{apifon_otp}

    Content-Type: application/json; charset=utf-8

    HTTP Method: POST

    Request

    Request headers

    Content-Type: application/json
    X-ApifonWS-Date: Thu, 29 Sep 2016 12:18:57 GMT
    Authorization: ApifonWS 5b5a6ca0deb4bdba5bab:x+va+3GCQQXqqDuNZjyTLgGIBKhEFhRtETTBy/daceY=
    Service Endpoint: /services/otp/verify/OTP-944706/862994
    Request body: No request body is supplied for the OTP verification service.
    

    The request object is an empty string.

    OTP Response

    After submitting a request using Apifon API, you will receive an HTTP response. The HTTP response will contain a JSON object.

    Response body

    {
        "request_id": "fc4a9c38-faed-42c3-affb-93571e9a8e36",
        "result_info": {
            "status_code": 0,
            "description": "Valid"
        }
    }
    
    Key Type Description
    request_id String The generated id for the given request.
    result_info RESULT_INFO A summary of the status of the request.

    JSON Response: RESULT_INFO

    Key Type Description
    status_code String A status code for the given request that follows the http standards ( 200 if OK, 403 if parameters are wrong, 401 if authentication error).
    description String A human friendly message that describes the status code.

    Here is a list of all the responses you can get as a response to your verification request.

    Status Code HTTP Code Description Meaning
    0 200 Valid The OTP provided is valid.
    1 200 Invalid The OTP provided has already been validated.
    2 403 Declined. The request was declined.
    3 403 The request code was not found Either your Reference ID or the OTP code is incorrect.
    4 403 No code was provided. OTP Code was not provided.
    5 403 No reference_id provided in request. Reference ID was not provided.
    6 403 Expired The expiration time of the OTP has passed.
    7 403 The request code is invalid. OTP is invalid.

    Callback Responses

    Callback

    Delivery reports and any other relevant intermediary status are signaled back to the client using an HTTP callback. The URL invoked is obtained from the “callback_url” field in the original message request. The request generated to this URL is described here. The endpoint on the client side, must fully support this kind of request and respond accordingly.

    If a callback_url was not specified in the request, a callback is not generated. In case of a batch request (a request that contains more than one subscribers) you should expect more than one callback responses, since more than one delivery report is obtained from the destination network in a very short time frame. The CallbackInfo JSON object is explained below.

    HTTP_HEADER

    Key Value
    content-type Application/Json

    SMS: POST -YourCallbackUrl- HTTP/1.1

    {
      "url": "https://yourserver/callback",
      "request_id": "eff655d8-0cb6-47b3-8828-96e1b80b55af",
      "reference_id": "Campaign #215",
      "data": [{
          "from": "Apifon",
          "to": "306999999999",
          "message_id": "e2d4424d-7d6a-49c2-b564-99b2b68c74cb",
          "status": {
            "code": 7,
            "text": "delivered"
          },
          "error_code": "000",
          "timestamp": 1517922078,
          "mccmnc": "20210"
        }
      ],
      "account_id": 5411,
      "type": "SMS"
    }
    

    Viber: POST -YourCallbackUrl- HTTP/1.1

    {
      "url": "https://yourserver/callback",
      "request_id": "ccb9111f-9ea0-4e01-882f-f72ee502e779",
      "reference_id": "Campaign #216",
      "data": [{
          "from": "Mookee",
          "to": "306999999999",
          "message_id": "6f3f5441-391f-473d-b822-cfb129f21238",
          "status": {
            "code": 10,
            "text": "seen"
          },
          "timestamp": 1517926706
        }
      ],
      "account_id": 5411,
      "type": "VIBER"
    }
    

    OTP: POST -YourCallbackUrl- HTTP/1.1

    {
        "url": "https://yourserver/callback",
        "request_id": "fc4a9c38-faed-42c3-affb-93571e9a8e36",
        "reference_id": "OTP-944706",
        "data": [{
                "from": "Apifon",
                "to": "306999999999",
                "message_id": "1c4ecbb0-f6db-44a3-95e9-8a581f1b48cd",
                "status": {
                    "code": 7,
                    "text": "delivered"
                },
                "error_code": "000",
                "timestamp": 1518536806,
                "mccmnc": "20210"
            }
        ],
        "account_id": 5195,
        "type": "SMS"
    }
    

    CALLBACK_RESPONSE

    Key Type Description
    url String The client’s url.
    request_id String The request id that is generated during the request.
    reference_id String The reference id that was given during the request.
    data CALLBACK_INFO* Contains all callback information. See table below.
    account_id String The client’s account id.
    type String SMS, VIBER, MAIL.

    CALLBACK_INFO

    Key Type Description
    from String The sender id.
    to String The number of the subscriber.
    message_id String The generated id of the message.
    status MESSAGE_STATUS* An embedded object for status.
    error_code String The dlr error code.
    timestamp LongNum The dlr timestamp.
    mccmnc String The mobile country code (MCC) and mobile network code (MNC) if applicable. (ex. “20201”).

    MESSAGE_STATUS

    Key Type Description
    code IntNum An integer that represents the given status.
    text String Description of message status.

    To view a list of all callback status codes click here.

    Callback Statuses

    Key Type Description
    Code Text Description
    1 absent No paging response from the Message Service.
    3 accepted Message accepted for delivery.
    4 accepted_smsc Messaged delivered to the Mobile Network Operator and should be delivered soon.
    5 call_barred Subscriber enabled call barring.
    7 delivered Message delivered to destination successfully.
    8 expired The validity period of the message has expired.
    18 rejected_smsc Message rejected by SMSC Provider.
    19 teleservice not provisioned. Destination has no SMS subscription.
    21 unexpected_value Messaged delivered to SMSC and an error occurred there.
    22 unknown_sub Number does not match to an MSISDN.
    23 smpp_refused Message refused by SMPP Provider.
    24 smsc_refused Message refused by SMSC Provider.
    100 bean_exception
    101 no_sender
    102 wrong_lookup_service
    103 invalid_sender
    104 no_lookup_service
    105 lookup_invalid_msisdn
    106 unknown_sender_type
    107 account_not_allowed
    108 SMSC_STAT_REJECTED_ERR_L108
    109 no_coverage
    110 no_price
    111 spam_control
    112 no_route_plan
    113 invalid_account
    114 invalid_service
    115 account_insufficient_credits
    116 service_insufficient_credits
    117 esme_invalid_account_service
    118 hlr_service_insufficient_credits

    Balance

    This service provides information about the account’s balance.

    Host URL: https://ars.apifon.com

    Service Endpoint: /services/balance

    Content-Type: application/json; charset=utf-8

    HTTP Method: POST

    Balance Request

    Request headers

    Content-Type: application/json
    X-ApifonWS-Date: Thu, 29 Sep 2016 12:18:57 GMT
    Authorization: ApifonWS 5b5a6ca0deb4bdba5bab:x+va+3GCQQXqqDuNZjyTLgGIBKhEFhRtETTBy/daceY=
    Request body: No request body is supplied for the balance service.
    

    The request object is an empty string.

    Balance Response

    Response body

    {
        "balance": "9864.0",
        "reserved": "0.0",
        "plafon": "0.0",
        "subscriptions": [{
                "senderId": "Apifon",
                "available": "300.0",
                "total": "300.0",
                "endDate": "Jun 30, 2018 11:59:59 PM"
            }
        ]
    }
    

    The details of the response can be found in the table below.

    Key Type Description
    balance String The total amount in your account.
    reserved String The reserved amount in your account.
    plafon String The amount to be credited.
    subscriptions Subscriptions** An array of subscription objects (more info below).
    [SUBSCRIPTION_1, SUBSCRIPTION_2, …]. Subscriptions will be an empty array if no subscription is currently active.

    Subscriptions**

    Key Type Description
    senderId String The sender ID of your subscription.
    available String The available amount of your subscription.
    total String The total amount of your subscription.
    endDate String The expiration date of your subscription.

    Error Codes

    The response codes are mapped as follows:

    Error Code Meaning
    400 Bad Request – The request is invalid and was not understood by the API.
    401 Unauthorized – Header “Authorization” missing, invalid, or revoked; and / or, your host IP is not in the authorized IPs list.
    403 The request contains invalid or illegal values.
    404 Not Found – The endpoint on which the request was sent to, does not exist, or does not implement the API requested.
    405 Method Not Allowed – If the endpoint received a request using an HTTP method (ex. GET instead of POST) that is not allowed by that endpoint.
    415 Unsupported Media Type – If the request was in a content-type not supported by the endpoint (ex. text/plain instead of application/json).
    429 Too many requests (Throttling).
    500 Internal Server Error.

    SDK

    Apifon’s SDK makes it simple for you to use our REST APIs and execute a wide range of server side coding tasks. You will find the most popular programming languages in these SDK helper libraries.

    SDK Explanation

    SMS Example

    Mookee.addCredentials("sms", "Your_SMS_Token", "Your_SMS_Secret_Key");
    Mookee.setActiveCredential("sms");
    
    String[] nums = {"306999999999"/*, "306999999998", "306999999997", ...*/};
    ArrayList<String> numbers = new ArrayList();
    numbers.addAll(Arrays.asList(nums));
    
    SMSResource smsResource = new SMSResource();
    SmsRequest smsRequest = new SmsRequest();
    
    MessageContent msgContent = new MessageContent();
    msgContent.setText("Hello There!");
    msgContent.setSenderId("Apifon");
    
    smsRequest.addStrSubscribers(numbers);
    smsRequest.setMessage(msgContent);
    
    GatewayResponse response = smsResource.send(smsRequest);
    printResult(response);
    
    <?php
    
    use Apifon\Mookee;
    use Apifon\Model\SmsRequest;
    use Apifon\Model\MessageContent;
    use Apifon\Resource\SMSResource;
    
    require_once("./Apifon/Model/IRequest.php");
    require_once("./Apifon/Model/SubscribersViewRequest.php");
    require_once("./Apifon/Mookee.php");
    require_once("./Apifon/Security/Hmac.php");
    require_once("./Apifon/Resource/AbstractResource.php");
    require_once("./Apifon/Resource/SMSResource.php");
    require_once("./Apifon/Response/GatewayResponse.php");
    require_once("./Apifon/Model/MessageContent.php");
    require_once("./Apifon/Model/SmsRequest.php");
    require_once("./Apifon/Model/SubscriberInformation.php");
    
    Mookee::addCredentials("sms","Your_SMS_Token", "Your_SMS_Secret_Key");
    Mookee::setActiveCredential("sms");
    
    $smsResource = new SMSResource();
    $smsRequest = new SmsRequest();
    
    $nums = ["306999999999", /*"306999999998", "306999999997", ...*/];
    
    $message = new MessageContent();
    $message->setText("Hello there!");
    $message->setSenderId("Apifon");
    
    $smsRequest->setStrSubscribers($nums);
    $smsRequest->setMessage($message);
    
    $response = $smsResource->send($smsRequest);
    var_dump($response);
    
    Mookee.AddCredentials("sms", "Your_SMS_Token", "Your_SMS_Secret_Key");
    Mookee.SetActiveCredential("sms");
    
    List<string> numbers = new List<string>();
    numbers.Add("306999999999");
    //numbers.Add("306999999998");
    //numbers.Add("306999999997");
    
    SMSResource smsResource = new SMSResource();
    SmsRequest smsRequest = new SmsRequest();
    
    MessageContent message = new MessageContent();
    message.Text = "Hello There!";
    message.SenderId = "Apifon";
    
    smsRequest.AddStrSubscribers(numbers);
    smsRequest.Message = message;
    
    GatewayResponse response = smsResource.Send(smsRequest);
    PrintOutput(response);
    
    import Apifon.Mookee as mookee
    from Apifon.Model.MessageContent import MessageContent
    from Apifon.Model.SmsRequest import SmsRequest
    from Apifon.Resource.SMSResource import SMSResource
    
    Mookee = mookee.Mookee.get_instance()
    
    Mookee.add_credentials("sms", "Your_SMS_Token", "Your_SMS_Secret_Key")
    Mookee.set_active_credential("sms")
    
    smsResource = SMSResource()
    smsRequest = SmsRequest()
    
    nums = ["306999999999"]
    
    msgContent = MessageContent()
    msgContent.text = "Hello There!"
    msgContent.sender_id = "Apifon"
    
    smsRequest.add_str_subscribers(nums)
    smsRequest.message = msgContent
    
    response = smsResource.send(smsRequest)
    print_json(response)
    
    var Mookee = require('./Apifon/Mookee');
    
    const SMSResource = require('./Apifon/Resource/SMSResource');
    const SmsRequest = require('./Apifon/Model/SmsRequest');
    const MessageContent = require('./Apifon/Model/MessageContent');
    
    Mookee.getInstance();
    Mookee.addCredentials("sms", "Your_SMS_Token", "Your_SMS_Secret_Key");
    Mookee.setActiveCredential("sms");
    
    var nums = ["306999999999"/*, "306999999998", "306999999997", ...*/];
    
    var smsResource = new SMSResource();
    var smsRequest = new SmsRequest();
    
    var msgContent = new MessageContent();
    msgContent.text = "Hello There!";
    msgContent.sender_id = "Apifon";
    
    smsRequest.addStrSubscribers(nums);
    smsRequest.message = msgContent;
    
    var response = smsResource.send(smsRequest);
    printJson(response);
    

    Viber Example

    Mookee.addCredentials("viber", "Your_Viber_Token", "Your_Viber_Secret_Key");
    Mookee.setActiveCredential("viber");
    
    String[] nums = {"306999999999"/*, "306999999998", "306999999997", ...*/};
    ArrayList<String> numbers = new ArrayList();
    numbers.addAll(Arrays.asList(nums));
    
    IMChannel imChannel = new IMChannel();
    ImRequest imRequest = new ImRequest();
    
    IMAction imAction = new IMAction();
    imAction.setTitle("Renew now!");
    imAction.setTargetUrl("https://www.apifon.com");
    
    imChannel.setSenderId("Mookee");
    imChannel.setText("50% discount on our membership fee if you renew your subscription today!");
    imChannel.addImage("http://assets.apifon.com/images/boy_girl.jpg");
    imChannel.addAction(imAction);
    
    imRequest.addStrSubscribers(numbers);
    imRequest.addImChannel(imChannel);
    
    GatewayResponse response = imResource.send(imRequest);
    printJson(response);
    
    <?php
    
    use Apifon\Mookee;
    use Apifon\Model\IMChannel;
    use Apifon\Model\ImRequest;
    use Apifon\Model\IMAction;
    use Apifon\Resource\IMResource;
    
    require_once ("./Apifon/Mookee.php");
    require_once ("./Apifon/Model/IMChannel.php");
    require_once ("./Apifon/Model/IRequest.php");
    require_once ("./Apifon/Model/SubscribersViewRequest.php");
    require_once ("./Apifon/Model/ImRequest.php");
    require_once ("./Apifon/Model/IMAction.php");
    require_once ("./Apifon/Model/SubscriberInformation.php");
    require_once ("./Apifon/Response/GatewayResponse.php");
    require_once ("./Apifon/Security/Hmac.php");
    require_once ("./Apifon/Resource/AbstractResource.php");
    require_once ("./Apifon/Resource/IMResource.php");
    
    Mookee::addCredentials("viber","Your_Viber_Token", "Your_Viber_Secret_Key");
    Mookee::setActiveCredential("viber");
    
    $imResource = new IMResource();
    
    $nums = ["306999999999", /*"306999999998", "306999999997", ...*/];
    
    $imChannel = new IMChannel();
    $imRequest = new ImRequest();
    
    $imAction = new IMAction();
    $imAction->setTitle("Renew now!");
    $imAction->setTargetUrl("https://www.apifon.com");
    
    $imChannel->setText("50% discount on our membership fee if you renew your subscription today!");
    $imChannel->setSenderId("Mookee");
    $imChannel->addImage("http://assets.apifon.com/images/boy_girl.jpg");
    $imChannel->addAction($imAction);
    
    $imRequest->setStrSubscribers($nums);
    $imRequest->addImChannel($imChannel);
    
    $response = $imResource->send($imRequest);
    var_dump($response);
    
    Mookee.AddCredentials("viber", "Your_Viber_Token", "Your_Viber_Secret_Key");
    Mookee.SetActiveCredential("viber");
    
    List<string> numbers = new List<string>();
    numbers.Add("306999999999");
    //numbers.Add("306999999998");
    //numbers.Add("306999999997");
    
    ImRequest imRequest = new ImRequest();
    
    IMAction imAction = new IMAction();
    imAction.Title = "Renew now!";
    imAction.TargetUrl = "https://www.apifon.com";
    
    IMChannel imChannel = new IMChannel();
    imChannel.Text = "50% discount on our membership fee if you renew your subscription today!";
    imChannel.SenderId = "Mookee";
    imChannel.AddImage("http://assets.apifon.com/images/boy_girl.jpg");
    imChannel.AddAction(imAction);
    
    imRequest.AddStrSubscribers(numbers);
    imRequest.AddImChannel(imChannel);
    
    response = imResource.Send(imRequest);
    PrintJson(response);
    
    import Apifon.Mookee as mookee
    from Apifon.Model.IMChannel import IMChannel
    from Apifon.Model.ImRequest import ImRequest
    from Apifon.Model.IMAction import IMAction
    from Apifon.Resource.IMResource import IMResource
    
    Mookee = mookee.Mookee.get_instance()
    
    Mookee.add_credentials("viber", "Your_Viber_Token", "Your_Viber_Secret_Key")
    Mookee.set_active_credential("viber")
    
    imResource = IMResource()
    
    nums = ["306999999999"]
    
    imChannel = IMChannel()
    imRequest = ImRequest()
    
    imAction = IMAction()
    imAction.title = "Renew now!"
    imAction.target_url = "https://www.apifon.com"
    
    imChannel.text = "50% discount on our membership fee if you renew your subscription today!"
    imChannel.sender_id = "Mookee"
    imChannel.add_image("http://assets.apifon.com/images/boy_girl.jpg")
    imChannel.add_action(imAction)
    
    imRequest.add_str_subscribers(nums)
    imRequest.add_im_channel(imChannel)
    
    response = imResource.send(imRequest)
    print_json(response)
    
    var Mookee = require('./Apifon/Mookee');
    
    const ImRequest = require('./Apifon/Model/ImRequest');
    const IMChannel = require('./Apifon/Model/IMChannel');
    const IMAction = require('./Apifon/Model/IMAction');
    const IMResource = require('./Apifon/Resource/IMResource');
    
    Mookee.getInstance();
    Mookee.addCredentials("viber", "Your_Viber_Token", "Your_Viber_Secret_Key");
    Mookee.setActiveCredential("viber");
    
    var imResource = new IMResource();
    
    var nums = ["306999999999"/*, "306999999998", "306999999997", ...*/];
    
    var imRequest = new ImRequest();
    var imChannel = new IMChannel();
    
    var imAction = new IMAction();
    imAction.title = "Renew now!";
    imAction.target_url = "https://www.apifon.com";
    
    imChannel.text = "50% discount on our membership fee if you renew your subscription today!";
    imChannel.sender_id = "Mookee";
    imChannel.addImage("http://assets.apifon.com/images/boy_girl.jpg");
    imChannel.addAction(imAction);
    
    imRequest.addStrSubscribers(nums);
    imRequest.addChannel(imChannel);
    
    var response = imResource.send(imRequest);
    printJson(response);
    

    Viber Example With Failover To SMS

    Mookee.addCredentials("viber", "Your_Viber_Token", "Your_Viber_Secret_Key");
    Mookee.setActiveCredential("viber");
    
    String[] nums = {"306999999999"/*, "306999999998", "306999999997", ...*/};
    ArrayList<String> numbers = new ArrayList();
    numbers.addAll(Arrays.asList(nums));
    
    IMChannel imChannel = new IMChannel();
    ImRequest imRequest = new ImRequest();
    
    IMAction imAction = new IMAction();
    imAction.setTitle("Renew now!");
    imAction.setTargetUrl("https://www.apifon.com");
    
    imChannel.setSenderId("Mookee");
    imChannel.setText("50% discount on our membership fee if you renew your subscription today!");
    imChannel.addImage("http://assets.apifon.com/images/boy_girl.jpg");
    imChannel.addAction(imAction);
    
    MessageContent msgContent = new MessageContent();
    msgContent.setText("Hello There!");
    msgContent.setSenderId("Apifon");
    
    imRequest.addStrSubscribers(numbers);
    imRequest.setMessage(msgContent);
    imRequest.addImChannel(imChannel);
    
    GatewayResponse response = imResource.send(imRequest);
    printJson(response);
    
    <?php
    
    use Apifon\Mookee;
    use Apifon\Model\IMChannel;
    use Apifon\Model\ImRequest;
    use Apifon\Model\IMAction;
    use Apifon\Model\MessageContent;
    use Apifon\Resource\IMResource;
    
    require_once ("./Apifon/Mookee.php");
    require_once ("./Apifon/Model/IMChannel.php");
    require_once ("./Apifon/Model/IRequest.php");
    require_once ("./Apifon/Model/SubscribersViewRequest.php");
    require_once ("./Apifon/Model/ImRequest.php");
    require_once ("./Apifon/Model/IMAction.php");
    require_once ("./Apifon/Model/SubscriberInformation.php");
    require_once ("./Apifon/Model/MessageContent.php");
    require_once ("./Apifon/Response/GatewayResponse.php");
    require_once ("./Apifon/Security/Hmac.php");
    require_once ("./Apifon/Resource/AbstractResource.php");
    require_once ("./Apifon/Resource/IMResource.php");
    
    Mookee::addCredentials("viber","Your_Viber_Token", "Your_Viber_Secret_Key");
    Mookee::setActiveCredential("viber");
    
    $imResource = new IMResource();
    
    $nums = ["306999999999", /*"306999999998", "306999999997", ...*/];
    
    $imChannel = new IMChannel();
    $imRequest = new ImRequest();
    
    $imAction = new IMAction();
    $imAction->setTitle("Renew now!");
    $imAction->setTargetUrl("https://www.apifon.com");
    
    $imChannel->setText("50% discount on our membership fee if you renew your subscription today!");
    $imChannel->setSenderId("Mookee");
    $imChannel->addImage("http://assets.apifon.com/images/boy_girl.jpg");
    $imChannel->addAction($imAction);
    
    $message = new MessageContent();
    $message->setText("Hello there!");
    $message->setSenderId("Apifon");
    
    $imRequest->setStrSubscribers($nums);
    $imRequest->setMessage($message);
    $imRequest->addImChannel($imChannel);
    
    $response = $imResource->send($imRequest);
    var_dump($response);
    
    Mookee.AddCredentials("viber", "Your_Viber_Token", "Your_Viber_Secret_Key");
    Mookee.SetActiveCredential("viber");
    
    List<string> numbers = new List<string>();
    numbers.Add("306999999999");
    //numbers.Add("306999999998");
    //numbers.Add("306999999997");
    
    ImRequest imRequest = new ImRequest();
    
    IMAction imAction = new IMAction();
    imAction.Title = "Renew now!";
    imAction.TargetUrl = "https://www.apifon.com";
    
    IMChannel imChannel = new IMChannel();
    imChannel.Text = "50% discount on our membership fee if you renew your subscription today!";
    imChannel.SenderId = "Mookee";
    imChannel.AddImage("http://assets.apifon.com/images/boy_girl.jpg");
    imChannel.AddAction(imAction);
    
    MessageContent msgContent = new MessageContent();
    msgContent.Text = "Hello There!";
    msgContent.SenderId = "Apifon";
    
    imRequest.AddStrSubscribers(numbers);
    imRequest.MessageContent = msgContent;
    imRequest.AddImChannel(imChannel);
    
    response = imResource.Send(imRequest);
    PrintJson(response);
    
    import Apifon.Mookee as mookee
    from Apifon.Model.IMChannel import IMChannel
    from Apifon.Model.ImRequest import ImRequest
    from Apifon.Model.IMAction import IMAction
    from Apifon.Model.MessageContent import MessageContent
    from Apifon.Resource.IMResource import IMResource
    
    Mookee = mookee.Mookee.get_instance()
    
    Mookee.add_credentials("viber", "Your_Viber_Token", "Your_Viber_Secret_Key")
    Mookee.set_active_credential("viber")
    
    imResource = IMResource()
    
    nums = ["306999999999"]
    
    imChannel = IMChannel()
    imRequest = ImRequest()
    
    imAction = IMAction()
    imAction.title = "Renew now!"
    imAction.target_url = "https://www.apifon.com"
    
    imChannel.text = "50% discount on our membership fee if you renew your subscription today!"
    imChannel.sender_id = "Mookee"
    imChannel.add_image("http://assets.apifon.com/images/boy_girl.jpg")
    imChannel.add_action(imAction)
    
    msgContent = MessageContent()
    msgContent.text = "Hello There!"
    msgContent.sender_id = "Apifon"
    
    imRequest.add_str_subscribers(nums)
    imRequest.message = msgContent
    imRequest.add_im_channel(imChannel)
    
    response = imResource.send(imRequest)
    print_json(response)
    
    var Mookee = require('./Apifon/Mookee');
    
    const ImRequest = require('./Apifon/Model/ImRequest');
    const IMChannel = require('./Apifon/Model/IMChannel');
    const IMAction = require('./Apifon/Model/IMAction');
    const MessageContent = require('./Apifon/Model/MessageContent');
    const IMResource = require('./Apifon/Resource/IMResource');
    
    Mookee.getInstance();
    Mookee.addCredentials("viber", "Your_Viber_Token", "Your_Viber_Secret_Key");
    Mookee.setActiveCredential("viber");
    
    var imResource = new IMResource();
    
    var nums = ["306999999999"/*, "306999999998", "306999999997", ...*/];
    
    var imRequest = new ImRequest();
    var imChannel = new IMChannel();
    
    var imAction = new IMAction();
    imAction.title = "Renew now!";
    imAction.target_url = "https://www.apifon.com";
    
    imChannel.text = "50% discount on our membership fee if you renew your subscription today!";
    imChannel.sender_id = "Mookee";
    imChannel.addImage("http://assets.apifon.com/images/boy_girl.jpg");
    imChannel.addAction(imAction);
    
    var msgContent = new MessageContent();
    msgContent.text = "Hello There!";
    msgContent.sender_id = "Apifon";
    
    imRequest.addStrSubscribers(nums);
    imRequest.message = msgContent;
    imRequest.addChannel(imChannel);
    
    var response = imResource.send(imRequest);
    printJson(response);
    

    Viber Example With Landing Page

    Mookee.addCredentials("viber", "Your_Viber_Token", "Your_Viber_Secret_Key");
    Mookee.setActiveCredential("viber");
    
    String[] names = {"John", "George", "Alex", "Helen"};
    String[] nums = {"306999999999"/*, "306999999998", "306999999997", ...*/};
    ArrayList<String> numbers = new ArrayList();
    numbers.addAll(Arrays.asList(nums));
    
    IMChannel imChannel = new IMChannel();
    ImRequest imRequest = new ImRequest();
    
    IMAction imAction = new IMAction();
    imAction.setTitle("Renew now!");
    imAction.setTargetUrl("{apifon_lp}");
    
    imChannel.setSenderId("Mookee");
    imChannel.setText("{name}! 50% discount on our membership fee if you renew your subscription today!");
    imChannel.addImage("http://assets.apifon.com/images/boy_girl.jpg");
    imChannel.addAction(imAction);
    
    ArrayList<SubscriberInformation> subscribers = new ArrayList();
    for (String num : numbers) {
        subscribers.add(new SubscriberInformation());
        subscribers.get(subscribers.size() - 1).setNumber(num);
        subscribers.get(subscribers.size() - 1).setPropertyToParam("name", names[subscribers.size() - 1]);
    
        LandingProperties lp = new LandingProperties();
        lp.setUrl("https://mookee.apifon.com/user/login/");
        lp.addData("name", names[subscribers.size() - 1]);
        lp.setRedirect(true);
    
        subscribers.get(subscribers.size() - 1).setLandingPage(lp);
    }
    
    imRequest.setSubscribers(subscribers);
    imRequest.addImChannel(imChannel);
    
    GatewayResponse response = imResource.send(imRequest);
    printJson(response);
    
    <?php
    
    use Apifon\Mookee;
    use Apifon\Model\IMChannel;
    use Apifon\Model\ImRequest;
    use Apifon\Model\IMAction;
    use Apifon\Model\LandingProperties;
    use Apifon\Model\SubscriberInformation;
    use Apifon\Resource\IMResource;
    
    require_once ("./Apifon/Mookee.php");
    require_once ("./Apifon/Model/IMChannel.php");
    require_once ("./Apifon/Model/IRequest.php");
    require_once ("./Apifon/Model/SubscribersViewRequest.php");
    require_once ("./Apifon/Model/ImRequest.php");
    require_once ("./Apifon/Model/IMAction.php");
    require_once ("./Apifon/Model/SubscriberInformation.php");
    require_once ("./Apifon/Model/LandingProperties.php");
    require_once ("./Apifon/Response/GatewayResponse.php");
    require_once ("./Apifon/Security/Hmac.php");
    require_once ("./Apifon/Resource/AbstractResource.php");
    require_once ("./Apifon/Resource/IMResource.php");
    
    Mookee::addCredentials("viber","Your_Viber_Token", "Your_Viber_Secret_Key");
    Mookee::setActiveCredential("viber");
    
    $imResource = new IMResource();
    
    $names = ["John", "Jim", "Alex", "Helen"];
    $nums = ["306999999999", /*"306999999998", "306999999997", ...*/];
    
    $imChannel = new IMChannel();
    $imRequest = new ImRequest();
    
    $imAction = new IMAction();
    $imAction->setTitle("Renew now!");
    $imAction->setTargetUrl("{apifon_lp}");
    
    $imChannel->setSenderId("Mookee");
    $imChannel->setText("{name}! 50% discount on our membership fee if you renew your subscription today!");
    $imChannel->addImage("http://assets.apifon.com/images/boy_girl.jpg");
    $imChannel->addAction($imAction);
    
    $subscribers = array();
    for ($i=0;$i<sizeof($nums);$i++){
        $lp = new LandingProperties();
        $lp->setUrl("https://mookee.apifon.com/user/login/");
        $lp->addData("name", $names[$i]);
        $lp->setRedirect(true);
    
        $sub = new SubscriberInformation();
        $sub->setNumber($nums[$i]);
        $sub->setCustomId("222");
        $sub->addParams("name", $names[$i]);
        $sub->setLandingPage($lp);
        $subscribers[] = $sub;
    }
    
    $imRequest->setSubscribers($subscribers);
    $imRequest->addImChannel($imChannel);
    
    $response = $imResource->send($imRequest);
    var_dump($response);
    
    Mookee.AddCredentials("viber", "Your_Viber_Token", "Your_Viber_Secret_Key");
    Mookee.SetActiveCredential("viber");
    
    string[] names = { "John", "George", "Alex", "Helen" };
    List<string> numbers = new List<string>();
    numbers.Add("306999999999");
    //numbers.Add("306999999998");
    //numbers.Add("306999999997");
    
    ImRequest imRequest = new ImRequest();
    
    IMAction imAction = new IMAction();
    imAction.Title = "Renew now!";
    imAction.TargetUrl = "{apifon_lp}";
    
    IMChannel imChannel = new IMChannel();
    imChannel.Text = "{name}! 50% discount on our membership fee if you renew your subscription today!";
    imChannel.SenderId = "Mookee";
    imChannel.AddImage("http://assets.apifon.com/images/boy_girl.jpg");
    imChannel.AddAction(imAction);
    
    List<SubscriberInformation> subscribers = new List<SubscriberInformation>();
    foreach (String num in numbers)
    {
        SubscriberInformation sub = new SubscriberInformation();
        sub.Number = num;
        sub.AddParams("name", names[subscribers.Count]);
    
        LandingProperties lp = new LandingProperties();
        lp.Url = "https://mookee.apifon.com/user/login/";
        lp.AddData("name", names[subscribers.Count]);
        lp.Redirect = true;
    
        sub.SetLandingPage(lp);
        subscribers.Add(sub);
    }
    
    imRequest.AddSubscribers(subscribers);
    imRequest.AddImChannel(imChannel);
    
    response = imResource.Send(imRequest);
    PrintJson(response);
    
    import Apifon.Mookee as mookee
    from Apifon.Model.IMChannel import IMChannel
    from Apifon.Model.ImRequest import ImRequest
    from Apifon.Model.IMAction import IMAction
    from Apifon.Model.SubscriberInformation import SubscriberInformation
    from Apifon.Model.LandingProperties import LandingProperties
    from Apifon.Resource.IMResource import IMResource
    
    Mookee = mookee.Mookee.get_instance()
    
    Mookee.add_credentials("viber", "Your_Viber_Token", "Your_Viber_Secret_Key")
    Mookee.set_active_credential("viber")
    
    imResource = IMResource()
    
    names = ["John", "George", "Alex", "Helen"]
    nums = ["306999999999"]
    
    imChannel = IMChannel()
    imRequest = ImRequest()
    
    imAction = IMAction()
    imAction.title = "Renew now!"
    imAction.target_url = "https://www.apifon.com"
    
    imChannel.text = "{name}! 50% discount on our membership fee if you renew your subscription today!"
    imChannel.sender_id = "Mookee"
    imChannel.add_image("http://assets.apifon.com/images/boy_girl.jpg")
    imChannel.add_action(imAction)
    
    subscribers = list()
    for num in nums:
        sub = SubscriberInformation()
        sub.number = num
        sub.add_params("name", names[len(subscribers)])
    
        lp = LandingProperties()
        lp.url = "https://mookee.apifon.com/user/login/"
        lp.add_data("name", names[len(subscribers)])
        lp.redirect = True
        sub.set_landing_page(lp)
    
        subscribers.append(sub)
    
    imRequest.add_subscribers(subscribers)
    imRequest.add_im_channel(imChannel)
    
    response = imResource.send(imRequest)
    print_json(response)
    
    var Mookee = require('./Apifon/Mookee');
    
    const ImRequest = require('./Apifon/Model/ImRequest');
    const IMChannel = require('./Apifon/Model/IMChannel');
    const IMAction = require('./Apifon/Model/IMAction');
    const SubscriberInformation = require('./Apifon/Model/SubscriberInformation');
    const LandingProperties = require('./Apifon/Model/LandingProperties');
    const IMResource = require('./Apifon/Resource/IMResource');
    
    Mookee.getInstance();
    Mookee.addCredentials("viber", "Your_Viber_Token", "Your_Viber_Secret_Key");
    Mookee.setActiveCredential("viber");
    
    var imResource = new IMResource();
    
    var names = ["John", "George", "Alex", "Helen"];
    var nums = ["306999999999"/*, "306999999998", "306999999997", ...*/];
    
    var imRequest = new ImRequest();
    var imChannel = new IMChannel();
    
    var imAction = new IMAction();
    imAction.title = "Renew now!";
    imAction.target_url = "{apifon_lp}";
    
    imChannel.sender_id = "Mookee";
    imChannel.text = "{name}! 50% discount on our membership fee if you renew your subscription today!";
    imChannel.addImage("http://assets.apifon.com/images/boy_girl.jpg");
    imChannel.addAction(imAction);
    
    var subscribers = [];
    for(var i = 0; i < nums.length; i++){
        var sub = new SubscriberInformation();
        sub.number = nums[i];
        sub.addParam("name", names[i])
    
        var lp = new LandingProperties();
        lp.url = "https://mookee.apifon.com/user/login/";
        lp.addData("name", names[subscribers.length]);
        lp.redirect = true;
    
        sub.setLandingPage(lp);
        subscribers.push(sub);
    }
    
    imRequest.addSubscribers(subscribers);
    imRequest.addChannel(imChannel);
    
    var response = imResource.send(imRequest);
    printJson(response);
    

    All of the SDKs were build so they are easy to use. The first thing you have to do is to add your credentials to the Mookee class. Mookee stores your credentials using a specific Key. As you can store multiple credentials, you have to specify the Active Credential Key, a.k.a. the credential that you want to use to send your request.

    Requests

    Class Parent Description
    IRequest ----- An abstract implementation of a Request.
    SubscriberViewRequest IRequst An abstract implementation of a Request that contains subscribers.
    RemoveRequest IRequest Represents a Deletion Request.
    SmsRequest SubscriberViewRequest Represents an SMS Request.
    ImRequest SubscriberViewRequest Represents an IM Request.

    Request properties

    Class Can Be Added To Description
    IMAction IMChannel Represents an Action for an IM Request.
    IMChannel ImRequest Represents a Channel for an IM Request.
    LandingProperties SubscriberInformation Represents a Landing Page for an SMS/IM Request.
    MessageContent SmsRequest/ImRequest Represents a Message for an SMS/IM Request.
    SubscriberInformation SmsRequest/ImRequest Represents a Subscriber for an SMS/IM Request.

    Resources

    Class Parent Description
    AbstractResource ----- An abstract implementation of a Resource.
    SMSResource AbstractResource An SMSResource is responsible for sending Send and Remove SMS Requests.
    IMResource AbstractResource An IMResource is responsible for sending Send and Remove IM Requests.
    BalanceResource AbstractResource A BalanceResource is responsible for sending Balance Requests.

    Responses

    Class Parent Description
    GatewayResponse ----- Represents the Response of our Request (SMS or IM).
    BalanceResponse ----- Represents the Response of our Balance Request.

    Mookee

    Method Parameters Description
    getInstance void Returns a reference to the Singleton Mookee instance.
    addCredentials key, token, secretKey Adds your credential in a map, using key as a keyIndicator.
    setActiveCredential key Defines the credentials that are to be used in the upcoming Requests.
    setStaging flag Set to true if you want your requests to be send to the Staging API.

    Download

    Please choose the file you want to download (.tar.gz or .zip).

    Java

    The JavaSDK project needs the following dependencies to run:
    gson-2.7.jar
    httpclient-4.5.2.jar
    commons-codec-1.9.jar
    commons-logging-1.2.jar
    httpcore-4.4.4.jar

    Building the JavaSDK will produce three .jar files:
    apifon-sdk-java.jar a library without the project dependencies.
    apifon-sdk-java-jar-with-dependencies.jar a library with the project dependencies.
    apifon-sdk-java-javadoc.jar contains the SDK javadoc.

    In order to include the apifon Java SDK to your own project you have to keep in mind that it requires the use of the dependencies mentioned above. This is why the project produces a .jar file containing those dependencies. In case your project has already included them, you can use the .jar file that does not contain the dependencies above, other ways you need to use the one containing this dependencies.

    apifon-sdk-java.tar.gz

    apifon-sdk-java.zip

    Php

    The PhpSDK also contains a WebServer (WebServer.php) where you can run your examples and test them. Running WebServer.php will display a web page with three TextAreas. The first will contain your Request Body, the second your Response Body and the third one your Callback Response. You may set your callback URL to http://yourserver/apifon-sdk-php/CallbackHandling/callback.php and your callback responses will be stored in the apifon-sdk-php/CallbackHandling/callback.txt text file. WebServer.php examples will clean the callback.txt file before receiving a new one.

    apifon-sdk-php.tar.gz

    apifon-sdk-php.zip

    C#

    apifon-sdk-csharp.tar.gz

    apifon-sdk-csharp.zip

    Python3

    apifon-sdk-python.tar.gz

    apifon-sdk-python.zip

    NodeJS

    apifon-sdk-nodejs.tar.gz

    apifon-sdk-nodejs.zip