0% found this document useful (0 votes)
97 views

Infobip HTTP API and SMPP Specification

The document provides information about using the Infobip API for sending SMS messages and receiving delivery reports. It includes examples of XML request bodies for sending messages, examples of the response received, and explanations of common status codes returned for messages and delivery reports. Code samples are given in PHP for making requests to the Infobip API and processing delivery report responses. Overall, the document serves as a technical guide for integrating with Infobip's SMS messaging APIs.

Uploaded by

pjdinis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views

Infobip HTTP API and SMPP Specification

The document provides information about using the Infobip API for sending SMS messages and receiving delivery reports. It includes examples of XML request bodies for sending messages, examples of the response received, and explanations of common status codes returned for messages and delivery reports. Code samples are given in PHP for making requests to the Infobip API and processing delivery report responses. Overall, the document serves as a technical guide for integrating with Infobip's SMS messaging APIs.

Uploaded by

pjdinis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Page 1

Page 2

Page 3

http://api2.infobip.com/api/sendsms/xml

http://api.infobip.com/api/sendsms/xml

Page 4
<SMS> <SMS>
<authentification> <authentification>
<username></username> <username></username>
<password></password> <password></password>
</authentification> </authentification>
<message> <message>
<sender></sender> <sender></sender>
<text></text> <text></text>
<flash></flash> 1 <flash></flash>1
<type></type> <type></type>
<wapurl></wapurl> <wapurl></wapurl>
<binary></binary> <binary></binary>
<datacoding></datacoding> <datacoding></datacoding>
<esmclass></esmclass> <esmclass></esmclass>
<srcton></srcton> <srcton></srcton>
<srcnpi></srcnpi> <srcnpi></srcnpi>
<destton></destton> <destton></destton>
<destnpi></destnpi> <destnpi></destnpi>
<sendDateTime></sendDateTime> <sendDateTime></sendDateTime>
<ValidityPeriod></ValidityPeriod> <ValidityPeriod></ValidityPeriod>
<appid></appid> <appid></appid>
<pushurl></pushurl> <pushurl></pushurl>
<nopush></nopush> <nopush></nopush>
</message> </message>
<recipients> <recipients>
<gsm></gsm> <gsm messageId=“clientmsgID1“></gsm>
<gsm></gsm> <gsm messageId=“clientmsgID2“></gsm>
<gsm></gsm> <gsm messageId=“clientmsgID3“></gsm>
<gsm></gsm> <gsm messageId=“clientmsgID4“></gsm>
</recipients> </recipients>
</SMS> </SMS>

<gsm>
messageId

messageId

messageId
messageId <gsm>

messageId

<binary> <text>

<DataCoding>8</DataCoding>

Page 5
username

password

sender

text

flash

type

wapurl

binary

DataCoding

Esmclass

Srcton

Srcnpi

Destton

Destnpi

ValidityPeriod

Page 6
sendDateTime

appid

pushurl*

nopush*

GSM

GSM messageId=“clientmsgID“

 Pushurl nopush pushurl nopush=0 pushurl


nopush=1

Page 7
<RESPONSE>
<status>status_code</status>
<credits>credit_amount<credits>
</RESPONSE>

Page 8
AUTH_FAILED

XML_ERROR

NOT_ENOUGH_CREDITS

NO_RECIPIENTS

GENERAL_ERROR

SEND_OK

<?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;
?>

<RESPONSE>
<status>3</status>7
<credits>20000</credits>
</RESPONSE>

<RESPONSE>
<status>-1</status>
<credits>0</credits>
</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

http://api2.infobip.com/api/sendsms/plain?user=xxx&password=xxxx&sender=Friend&binary=41424344&GSM=38598514674

esmclass

http://api2.infobip.com/api/sendsms/plain?user=xxx&password=xxxx&sender=Friend&binary=06050400010241424344&GSM=385985146
74&esmclass=64

Binary SMSText
encoding
DataCoding=8

user

password

sender

SMSText

GSM

IsFlash

Type

Bookmark

DataCoding

Esmclass

Page 11
Binary

Srcton

Srcnpi

Destton

Destnpi

ValidityPeriod

sendDateTime

encoding

appid

pushurl*

nopush*

 Pushurl nopush pushurl nopush=0 pushurl


nopush=1

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

<DeliveryReport>
<message id="msgID" sentdate="xxxxx" donedate="xxxxx" status="xxxxxx" />
.....
</DeliveryReport>

Page 14
NOT_SENT

SENT

NOT_DELIVERED

DELIVERED

NOT_ALLOWED

INVALID_DESTINATION_ADDRESS

INVALID_SOURCE_ADDRESS

ROUTE_NOT_AVAILABLE

NOT_ENOUGH_CREDITS

INVALID_MESSAGE_FORMAT

http://yourserver.com/collector.php

<?php
// read raw POST data
$postData = file_get_contents("php://input");
// extract XML structure from it using PHP’s 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 OK
FAILED
OK FAILED messageId

OK
123456;OK;121c0a6b752-1-92
23423423232;OK;121c0a6b752-1-93
23'0498239048230;FAILED;
2343223;OK;121c0a6b752-1-94 sdfsd;FAILED;
23422342342;OK;121c0a6b752-1-95
234234;OK;121c0a6b752-1-96

Page 17
dlr

dlr=destinationAddress;messageId;status;IMSI;servingMSC;errorCode;servingHLR;origNetName;
portedNetName;roamingNetName;roamingCountryCode;MCCMNC;roamingCountryName;pricePerMsg;
origNetPrefix;origCountryName;origCountryCode;origCountryPrefix;isNumberPorted;roamingNetPrefix;
roamingCountryPrefix;isNumerCorrect8

destinationAddress;messageId;status;IMSI;servingMSC;errorCode;servingHLR;origNetName;
portedNetName;roamingNetName;roamingCountryCode;MCCMNC;roamingCountryName;pricePerMsg;
origNetPrefix;origCountryName;origCountryCode;origCountryPrefix;isNumberPorted;roamingNetPrefix;
roamingCountryPrefix;isNumerCorrect9

 DELIVRD

 UNDELIV

 UNKNOWN

DLR=385981977300;12a1cff5659-1-13;DELIVRD;219011000205310;38598040004;0;3859812003;
T-Mobile HR;T-Mobile HR;T-Mobile HR;HR;21901;Croatia;100;98;Croatia;HR;385;98;385;true;
38598111111;12a1cff5659-1-14;UNDELIV;;;1153;T-Mobile HR;;100;98;Croatia;HR;385;null;null;true;

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>

comma
xml
json

















Page 19




 DELIVRD

 UNDELIV

 UNKNOWN

 REJECTD

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

38598xxxxxxx;12a1d36009f-1-1d;DELIVRD;219011000245540;38598042003;0;3859812004;
T-Mobile HR;T-Mobile HR;T-Mobile HR;HR;21901;Croatia ;100;98;Croatia ;HR;385;false;98;
385;true;

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>

Page 20
<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 21
PARAMETER DESCRIPTION

Page 22
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 23
NAME DESCRIPTION

smpp3.infobip.com
smpp1.infobip.com

Page 24
Name Type Hex Decimal

Page 25
SMPP_VENDOR_SPECIFIC_IMSI = 0x1403

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 26
Page 27
HTTP - Hypertext Transfer Protocol

SMPP - Short message peer-to-peer protocol

Delivery reports

Home Location Register (HLR)

IMSI - International Mobile Subscriber Identity

SMS on Wikipedia

SMS Tutorial

Short message service technical realization (GSM)

Page 28

You might also like