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

Infobip HTTP API and SMPP Specification

Previously formatted XML data becomes value of "XML" in this example, POST request was made using PHP's curl $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $postUrl); curl_close($ch); / / write out the response echo $response;?>.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
613 views

Infobip HTTP API and SMPP Specification

Previously formatted XML data becomes value of "XML" in this example, POST request was made using PHP's curl $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $postUrl); curl_close($ch); / / write out the response echo $response;?>.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23


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

http://api2.infobip.com/api/sendsms/xml
<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> <flash></flash>
<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>
<ValidityPeriod></ValidityPeriod> <ValidityPeriod></ValidityPeriod>
</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
username

password

sender

text

flash

type

wapurl

binary

DataCoding

Esmclass

Srcton

Srcnpi

Destton

Destnpi

ValidityPeriod

GSM

GSM messageId=“clientmsgID“
<RESPONSE>
<status>status_code</status>
<credits>credit_amount<credits>
</RESPONSE>

AUTH_FAILED

XML_ERROR

NOT_ENOUGH_CREDITS

NO_RECIPIENTS

GENERAL_ERROR

SEND_OK

<?php
// Infobip's POST URL
$postUrl = "http://api.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;
?>
<?php
// Infobip's POST URL
$postUrl = "http://api.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>
<credits>20000</credits>
</RESPONSE>

<RESPONSE>
<status>-1</status>
<credits>0</credits>
</RESPONSE>
http://api.infobip.com/api/sendsms/plain
http://api2.infobip.com/api/sendsms/plain

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

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

esmclass

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

user

password

sender

SMSText

GSM

IsFlash

Type

Bookmark

DataCoding

Esmclass

Binary

Srcton

Srcnpi

Destton

Destnpi

ValidityPeriod
http://api.infobip.com/api/command?username=X&password=X&cmd=X

http://api2.infobip.com/api/command?username=X&password=X&cmd=X

CREDITS
messageId
messageId

www.infobip.com

<deliveryreport>
<message id="msgID" sentdate="xxxxx" donedate="xxxxx" status="xxxxxx" />
.....
</deliveryreport>
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');
}
?>
http://api.infobip.com/api/dlrpull?user=xxx&password=xxxx

http://api2.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>
http://api.infobip.com/api/hlr/query.aspx
http://api2.infobip.com/api/hlr/query.aspx

http://api.infobip.com/api/hlr/query.aspx?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
dlr

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

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

 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;
http://api.infobip.com/api/hlr/sync
http://api2.infobip.com/api/hlr/sync

http://api.infobip.com/api/hlr/sync?user=<username>&pass=<password>&destination=<destination>&output=<output>

comma
xml
json























http://api.infobip.com/api/hlr/sync?user=<username>&pass=<password>&destination=38598xxxxxxx&output=comma

http://api.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;98;
385;true;

http://api.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>
<RNP>98</RNP>
<RCP>385</RCP>
<NUM_OK>true</NUM_OK>
</hlr>

http://api.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",
"RNP":"98","RCP":"385","NUM_OK":"true"}
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
smpp1.infobip.com
smpp3.infobip.com
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) )
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)

You might also like