Sending of multiple SMS

This API is used for sending several SMS at once using ProfiSMS (billing is included in sending). If you want to send SMS to multiple numbers, but with the same message and other parameters, you can use regular API for SMS sending

Basic description and parameters of API calls can be found on this page.

You can use testing user for testing purposes.

Service

SMS API belongs to SMS service (sms).

API request

API request must contain all general parameters.

CTRL

Fixed value: sms_multi

data

JSON defining every SMS. It's array of objects (hashed/associative arrays), where every object defines one SMS (to be sent to one or more numbers). Objects properties (array hashes) are the same as parameters in regular API for SMS sending

In case of PHP, both object and hashed array are encoded as object in JSON.

API request examples

example 1: Request for sending 2 SMS (PHP implementation)
$login = 'user';
$upassword = md5("passwd");
$call = microtime(true);
$password = md5($upassword.$call);

// DEFINING OF SMS
// There is pid parameter defined for every message, it is not mandatory, but
// can be used for idenifying message in response  
$data = array(
  //wappush
  array(
    "text" => "http://seznam.cz/",
    "msisdn" => '605582922',
    "address" => 'http://test.company.cz/receive.php',
    "currency" => 'CZK',
    "type" => 'wappush',
    "name" => "SEZNAM",
    "pid" => "f4d505b9e1",
  ),
  //text SMS
  array(
    "text" => "příliš žluťoučký kůň úpěl ďábelské ódy, PŘÍLIŠ ŽLUŤOUČKÝ KŮŇ ÚPĚL ĎÁBELSKÉ ÓDY",
    "msisdn" => '603110000, 531123456,+421905123456,999999999',
    "split" => 'concat',
    "source" => 'Company',
    "currency" => 'CZK',
    "validity" => 1440,
    "pid" => "860310b4dd",
  ),
);

// POST PARAMETERS
$post = array(
  "CTRL" => "sms_multi",
  "_login" => $login,
  "_password" => $password,
  "_service" => "sms",
  "_call" => $call,

  "data" => json_encode($data),
);

// WE ARE USING CURL, REQUEST IS PASSED USING POST PROTOCOL,
// GET PROTOCOL CAN BE USED, BUT URL IS LIMITED TO 2048 CHARACTERS
// AND WHEN SENDING SEVERAL SMS, SUCH SITUATION CAN OCCURE
$options = array(
  CURLOPT_POST => 1,
  CURLOPT_HEADER => 0,
  CURLOPT_URL => "https://api.profisms.cz/index.php?",
  CURLOPT_FRESH_CONNECT => 1,
  CURLOPT_RETURNTRANSFER => 1,
  CURLOPT_FORBID_REUSE => 1,
  CURLOPT_FOLLOWLOCATION => 1,
  CURLOPT_POSTFIELDS => $post,
);
$ch = curl_init();
curl_setopt_array($ch, $options);
$json = curl_exec($ch);
curl_close($ch);

/*
Parameter data in POST will look this way:
[
  {
    "text":"http:\/\/seznam.cz\/",
    "msisdn":"605582922",
    "address":"http:\/\/test.company.cz\/receive.php",
    "currency":"CZK",
    "type":"wappush",
    "name":"SEZNAM",
    "pid":"f4d505b9e1"
  }
  ,
  {
    "text":"p\u0159\u00edli\u0161 \u017elu\u0165ou\u010dk\u00fd k\u016f\u0148 \u00fap\u011bl \u010f\u00e1belsk\u00e9 \u00f3dy, P\u0158\u00cdLI\u0160 \u017dLU\u0164OU\u010cK\u00dd K\u016e\u0147 \u00daP\u011aL \u010e\u00c1BELSK\u00c9 \u00d3DY",
    "msisdn":"603110000, 531123456,+421905123456,999999999",
    "split":"concat",
    "source":"Company",
    "currency":"CZK",
    "validity":1440,
    "pid":"860310b4dd"
  }
]
*/

  

You should not send more that 20 messages at once because of performance.

Response to valid API request

Basic response can be found in general API description.

Data array description

data is array of objects corresponding to response when sending of 1 SMS is reguested, the whole response.

Parameter key in each object should not be validated (there is no reference for such validation).

example 2: Example 1 response
{
  "error":
  {
    "code":0,
    "message":"OK"
  } ,
  "data":
  [
    {
      "error":
      {
        "code":0,
        "message":"OK"
      },
      "data":
      {
        "invalid":[],
        "sms":
        [
          {
          "price":2,
          "pricevat":2.4,
          "msisdn":"+420605582922",
          "id":3217649,
          "state":"queued",
          "delivery":"nostate",
          "queued":"2011-01-17 02:41:23",
          "delivered":"",
          "part":[45783715]
          }
        ],
        "credit":-150.588,
        "price":2,
        "pricevat":2.4,
        "address":"http:\/\/test.company.cz\/receive.php",
        "partsCount":1,
        "pid":"f4d505b9e1"
      },
      "_key":"a79178c9211678df62f2781edf5321f5",
      "_time":2.5399770736694
    },
    {
      "error":
      {
        "code":0,
        "message":"OK"
      },
      "data":
      {
        "invalid":["999999999"],
        "sms":
        [
          {
            "price":3.4,
            "pricevat":4.08,
            "msisdn":"+420603110000",
            "id":3217653,
            "state":"queued",
            "delivery":"nostate",
            "queued":"2011-01-17 02:41:26",
            "delivered":"",
            "part":[45783719, 45783720]
          },
          {
            "price":4,
            "pricevat":4.8,
            "msisdn":"+420531123456",
            "id":3217654,
            "state":"queued",
            "delivery":"nostate",
            "queued":"2011-01-17 02:41:27",
            "delivered":"",
            "part":[45783722, 45783723]
          },
          {
            "price":5,
            "pricevat":6,
            "msisdn":"+421905123456",
            "id":3217656,
            "state":"queued",
            "delivery":"nostate",
            "queued":"2011-01-17 02:41:27",
            "delivered":"",
            "part":[45783724, 45783725]
          }
        ],
        "credit":-165.468,
        "price":12.4,
        "pricevat":14.88,
        "address":"",
        "partsCount":2,
        "pid":"860310b4dd"
      },
      "_key":"9fbd13da2f3c88386cd27e8dbdad0925",
      "_time":3.7670719623566
    }
  ],
  "_key":"11ac0e94474ad968de664026b0dd8982",
  "_time":7.2745580673218
}
  

Response to invalid request

Description can be found in general API description.

Object error of the response itself defines the validity of the request (e.g. user's login error), not whether error occurred while sending passed messages. In case request is valid but there is an error in a message (or more messages), such error is described in message response.

example 3: Valid request but error while sending SMS
// following response shows valid request, valid sending of the 1st message
// and error while sending 2nd message
{
  "error":
  {
    "code":0,
    "message":"OK"
  },
  "data":
  [
    {
      "error":
      {
        "code":0,
        "message":"OK"
      },
      "data":
      {
        "invalid":[],
        "sms":
        [
          {
          "price":2,
          "pricevat":2.4,
          "msisdn":"+420605582922",
          "id":3217649,
          "state":"queued",
          "delivery":"nostate",
          "queued":"2011-01-17 02:41:23",
          "delivered":"",
          "part":[45783715]
          }
        ],
        "credit":-150.588,
        "price":2,
        "pricevat":2.4,
        "address":"http:\/\/test.company.cz\/receive.php",
        "partsCount":1,
        "pid":"f4d505b9e1"
      },
      "_key":"a79178c9211678df62f2781edf5321f5",
      "_time":2.5399770736694
    },
    {
      "error":
      {
        "code":20,
        "message":"BA_LOW_CREDIT"
      },
      "data":
      {
        "invalid":["999999999"],
        "sms":[],
        "credit":-182.748,
        "price":0,
        "pricevat":0,
        "address":"",
        "partsCount":0,
        "pid":"cb43f72f0c"
      },
      "_time":2.3327369689941
    }
  ],
  "_key":"302943b04d40d7a8581646c7c149183b",
  "_time":5.4903519153595
}
  

Delivery reports

Sending of delivery reports follows every SMS settings. Functionality is the same as in case of delivery report for one SMS.