API Documentation

How to send SMS via API?

username - Username
password - Password
sender - SMS Sender
def_time - Time to send bulk SMS, if not defined, current time will be used
id - optional unique ID of SMS generated by the customer, identification for delivery receipts HTTP GET/POST method
name - optional Customer Name
idc - optional Customer ID, for exporting delivery receipts to CSV, XLS
send_time - SMS sending time, superior def_time
unicode - SMS will be sent with diacritics
phone - Phone Number
text - SMS Text
callback - a delivery receipt for SMS will be sent to the defined URL. It is necessary to define a unique message ID for subsequent assignment of SMS delivery status

Príklad odoslania SMS

<?php 
define('XML_PAYLOAD', '<?xml version="1.0" encoding="UTF-8"?>
<sms>
    <credential>
        <username>username</username>
        <password>password or API key</password>
    </credential>
      <message>
        <sender>mycompany</sender>
        <def_time>2016-12-31 23:59:00</def_time>
        <recipients>
         <recipient>
            <id>121</id>  
            <unicode>0</unicode>
            <phone>421911123456</phone>
            <text>Text first SMS</text>
        </recipient>
            <recipient>
             <id>122</id>
             <send_time>2017-12-31 23:59:00</send_time>
             <unicode>1</unicode>
             <phone>421944123456</phone>
            <text>Text SMS 2 unicode čžýáíáť</text>
            </recipient>
            <recipient>
             <id>123</id>
             <name>Janko Hraško</name>
             <idc>12345</idc>
             <send_time></send_time>
             <unicode>0</unicode>
             <phone>42190512346</phone>
             <text>Text 3</text>
            </recipient>
        </recipients>
    </message>
    <optional>
             <callback>https://www.domain.com/sms/callback.php</callback>
    </optional>
</sms>'); 
define('XML_POST_URL', 'https://www.acalby.com/api/sms-xml/'); 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, XML_POST_URL); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_TIMEOUT, 60); 
curl_setopt($ch, CURLOPT_POSTFIELDS, XML_PAYLOAD); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close')); 
$result = curl_exec($ch); 
if (curl_errno($ch) ) 
{ 
$result = 'ERROR -> ' . curl_errno($ch) . ':' . curl_error($ch); 
} 
else 
{ 
$returnCode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE); 
switch($returnCode) 
   { 
   case 200: $xmlObject = new SimpleXMLElement($result);   
             $status = $xmlObject->status; 
             $balance = $xmlObject->balance; 
             $errorsms = $xmlObject->errorsms;
             $failedsms = $xmlObject->failedsms;  
   break; 
   case 404: 
   $result = 'ERROR -> 404'; 
   break; 
   default: 
       } 
} 
curl_close($ch); 

?> 
 

 

XML Response

<response>
<status>1</status>
<balance>64.2454</balance>
<sentsms>3</sentsms>
<errorsms></errorsms>
<failedsms></failedsms>
</response>

 

status

1 incoming call

- 1 incorrect login credentials

sentsms number of successfully received SMS into the system

errorsms number of unsent SMS due to incorrect numbers

failedsms number of unsent SMS due to low credit

 

 

Delivery Receipts -

status: status=delivered, undelivered

id: id=123456