Infobip HTTP API and SMPP Specification
Infobip HTTP API and SMPP Specification
Page 2
Page 3
http://api2.infobip.com/api/sendsms/xml http://api.infobip.com/api/sendsms/xml
Page 4
<SMS> <authentification> <username></username> <password></password> </authentification> <message> <sender></sender> <text></text> <flash></flash> 1 <type></type> <wapurl></wapurl> <binary></binary> <datacoding></datacoding> <esmclass></esmclass> <srcton></srcton> <srcnpi></srcnpi> <destton></destton> <destnpi></destnpi> <sendDateTime></sendDateTime> <ValidityPeriod></ValidityPeriod> <appid></appid> <pushurl></pushurl> <nopush></nopush> </message> <recipients> <gsm></gsm> <gsm></gsm> <gsm></gsm> <gsm></gsm> </recipients> </SMS>
<SMS> <authentification> <username></username> <password></password> </authentification> <message> <sender></sender> <text></text> <flash></flash>1 <type></type> <wapurl></wapurl> <binary></binary> <datacoding></datacoding> <esmclass></esmclass> <srcton></srcton> <srcnpi></srcnpi> <destton></destton> <destnpi></destnpi> <sendDateTime></sendDateTime> <ValidityPeriod></ValidityPeriod> <appid></appid> <pushurl></pushurl> <nopush></nopush> </message> <recipients> <gsm messageId=clientmsgID1></gsm> <gsm messageId=clientmsgID2></gsm> <gsm messageId=clientmsgID3></gsm> <gsm messageId=clientmsgID4></gsm> </recipients> </SMS>
<binary>
<text> <DataCoding>8</DataCoding>
Page 5
text flash
type
wapurl
binary
DataCoding
Esmclass
sendDateTime
appid
Page 6
pushurl*
nopush*
GSM
GSM messageId=clientmsgID
Pushurl
nopush nopush=1
pushurl
nopush=0
pushurl
Page 7
Page 8
<?php // Infobip's POST URL $postUrl = "http://api2.infobip.com/api/sendsms/xml"; // XML-formatted data $xmlString = "<SMS> <authentification> <username>xxx</username> <password>xxxx</password> </authentification> <message> <sender>Friend</sender> <text>Message from your friend!</text> </message> <recipients> <gsm>38598514674</gsm> <gsm>38591222344</gsm> <gsm>385956773453</gsm> </recipients> </SMS>"; // previously formatted XML data becomes value of "XML" POST variable $fields = "XML=" . urlencode($xmlString); // in this example, POST request was made using PHP's CURL $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $postUrl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); // response of the POST request $response = curl_exec($ch); curl_close($ch); // write out the response echo $response; ?>
Page 9
<?php // Infobip's POST URL $postUrl = "http://api2.infobip.com/api/sendsms/xml"; // XML-formatted data $xmlString = "<SMS> <authentification> <username>xxx</username> <password>xxxx</password> </authentification> <message> <sender>Friend</sender> <text>Message from your friend!</text> </message> <recipients> <gsm messageId=\"1000\">38598514674</gsm> <gsm messageId=\"1001\">38591222344</gsm> <gsm messageId=\"1002\">385956773453</gsm> </recipients> </SMS>"; // previously formatted XML data becomes value of "XML" POST variable $fields = "XML=" . urlencode($xmlString); // in this example, POST request was made using PHP's CURL $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $postUrl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); // response of the POST request $response = curl_exec($ch); curl_close($ch); // write out the response echo $response; ?>
Page 10
http://api2.infobip.com/api/sendsms/plain http://api.infobip.com/api/sendsms/plain
http://api2.infobip.com/api/sendsms/plain?user=xxx&password=xxxx&sender=Friend&SMSText=messagetext&GSM=38598514674
Binary encoding
SMSText DataCoding=8
Type
Bookmark DataCoding
Esmclass
Binary
Page 11
sendDateTime
encoding
appid
pushurl*
nopush*
Pushurl
nopush nopush=1
pushurl
nopush=0
pushurl
Page 12
http://api2.infobip.com/api/command?username=X&password=X&cmd=X http://api.infobip.com/api/command?username=X&password=X&cmd=X
CREDITS
Page 13
messageId messageId
www.infobip.com
Page 14
NOT_SENT
INVALID_DESTINATION_ADDRESS INVALID_SOURCE_ADDRESS
http://yourserver.com/collector.php <?php // read raw POST data $postData = file_get_contents("php://input"); // extract XML structure from it using PHPs DOMDocument Document Object Model parser $dom = new DOMDocument(); $dom->loadXML($postData); // create new XPath object for quering XML elements (nodes) $xPath = new domxpath($dom); // query message element $reports = $xPath->query("/DeliveryReport/message"); // write out attributes of each message element foreach ($reports as $node) { echo <br>id: . $node->getAttribute('id'); echo <br>sent: . $node->getAttribute('sentdate'); echo <br>done: . $node->getAttribute('donedate'); echo <br>status: . $node->getAttribute('status'); } ?>
Page 15
http://api2.infobip.com/api/dlrpull?user=xxx&password=xxxx http://api.infobip.com/api/dlrpull?user=xxx&password=xxxx
<DeliveryReport> <message id="1000" sentdate="2010/8/2 14:55:10" donedate="2010/8/2 14:55:16" status="DELIVERED" /> <message id="1002" sentdate="2010/8/2 14:55:10" donedate="2010/8/2 14:55:16" status="DELIVERED" /> <message id="1001" sentdate="2010/8/2 14:55:10" donedate="2010/8/2 14:55:17" status="DELIVERED" /> </DeliveryReport>
<DeliveryReport> <message id="1023012301" sentdate="2005/7/19 22:0:0" donedate="2005/7/19 22:0:0" status="NOT_SENT" /> </DeliveryReport>
Page 16
http://api2.infobip.com/api/hlr/ http://api.infobip.com/api/hlr/
http://api2.infobip.com/api/hlr/?user=XXXX&pass=XXXX&destinations=XXX
OK FAILED
OK
Page 17
Page 18
http://api2.infobip.com/api/hlr/sync http://api.infobip.com/api/hlr/sync
http://api2.infobip.com/api/hlr/sync?user=<username>&pass=<password>&destination=<destination>&output=<output>
Page 19
http://api2.infobip.com/api/hlr/sync?user=<username>&pass=<password>&destination=38598xxxxxxx&output=comma http://api2.infobip.com/api/hlr/sync?user=<username>&pass=<password>&destination=38598xxxxxxx
http://api2.infobip.com/api/hlr/sync?user=<username>&pass=<password>&destination=38598xxxxxxx&output=xml
<?xml version="1.0" encoding="utf-8"?> <hlr> <destination>38598xxxxxxx</destination> <id>12a1d3981ac-1-1e</id> <stat>DELIVRD</stat> <IMSI>219011000020098</IMSI> <MSC>38598040004</MSC> <err>0</err> <hlr>3859812007</hlr> <orn>T-Mobile HR</orn> <pon>T-Mobile HR</pon> <ron>T-Mobile HR</ron> <roc>HR</roc> <mccmnc>21901</mccmnc> <rcn>Croatia</rcn> <ppm>100</ppm> <onp>98</onp> <ocn>Croatia</ocn> <occ>HR</occ> <ocp>385</ocp> <is_ported>false</is_ported> <rnp>98</rnp> <rcp>385</rcp> <num_ok>true</num_ok> </hlr>
http://api2.infobip.com/api/hlr/sync?user=<username>&pass=<password>&destination=38598xxxxxxx&output=json
{"destination":"38598xxxxxxx","id":"12a1d3c5a55-1-21","stat":"DELIVRD", "IMSI":"219011000075519","MSC":"38598040004","err":"0","hlr":"3859812006","orn": "T-Mobile HR","pon":"T-Mobile HR","ron":"T-Mobile HR","roc":"HR","mccmnc":"21901", "rcn":"Croatia ","ppm":"100","onp":"98","ocn":"Croatia ","occ":"HR","ocp":"385","is_ported":"false", "rnp":"98","rcp":"385","num_ok":"true"}
Page 20
PARAMETER
DESCRIPTION
Page 21
http://some.server.com/incoming_sms.php?who=%sender%&what=%text%
http://some.server.com/incoming_sms.php?who=38598123123&what=ABC
http://some.server.com/incoming_sms.php?who=%sender%&what=%bin%
http://some.server.com/incoming_sms.php?who=38598123123&what=414243
http://api2.infobip.com/api/inbox?user=<username>&password=<password>&limit=<limit>&output=<output>
http://api.infobip.com/api/inbox?user=<username>&password=<password>&limit=<limit>&output=<output>
NAME
DESCRIPTION
Page 22
NAME
DESCRIPTION
smpp3.infobip.com smpp1.infobip.com
Page 23
NAME
TYPE
HEX
DECIMAL
SMPP_VENDOR_SPECIFIC_IMSI = 0x1403
Page 24
addr: 0 0 38591xxxxxxx addr: 0 0 0000000000 msg: id:40072910491427628 sub:001 dlvrd:001 submit date:1007291049 done date:1007291049 stat:DELIVRD err:000 IMSI:219101100935850 MSC:38591016 HLR:38591xxxxxxx ORN:VipNet PON:VipNet RON:VipNet ROC:HR MCCMNC:21910 opt: (oct: (tlv: 1059) 030000) (byte: (tlv: 1063) 2) (str: (tlv: 30) 40072910491427628) (str: (tlv: 5129) 38591xxxxxxx) (str: (tlv: 5138) VipNet) (str: (tlv: 5139) VipNet) (str: (tlv: 5140) VipNet) (str: (tlv: 5141) Croatia ) (str: (tlv: 5143) HR) (str: (tlv: 5142) 21910) (int: (tlv: 5144) 1) (str: (tlv: 5145) 91) (str: (tlv: 5152) 385) (int: (tlv: 5153) 1) (str: (tlv: 5154) Croatia ) (str: (tlv: 5155) HR) (str: (tlv: 5156) 385) (int: (tlv: 5157) 1) ) (extraopt: (oct: (tlv: 5123) 323139313031313030393335383530) (oct: (tlv: 5126) 3338353931303136) )
addr: 0 0 385915369423 addr: 0 0 0000000000 msg: id:40072910491419819 sub:001 dlvrd:001 submit date:1007291049 done date:1007291049 stat:UNDELIV err:001 IMSI: MSC: ORN:VipNet MCCMNC: opt: (oct: (tlv: 1059) 030001) (byte: (tlv: 1063) 5) (str: (tlv: 30) 40072910491419819) (str: (tlv: 5138) VipNet) (str: (tlv: 5142) ) (int: (tlv: 5144) 1) (int: (tlv: 5153) 0) (str: (tlv: 5154) Croatia ) (str: (tlv: 5155) HR) (str: (tlv: 5156) 385) (int: (tlv: 5157) 1) )
Page 25
Page 26
Page 27
Delivery reports
SMS on Wikipedia
SMS Tutorial
Page 28