Deewan-SMS-Gateway - Technical
Deewan-SMS-Gateway - Technical
Page 1 of 15
Document Version1.0
List of Contents
Part No. Contents Page
1 Overview 3
2 HTTP Interface Specifications 3
2.1 Basic Query 3
2.2 Query Parameter Description 4
2.3 HTTP Interface Response 5
2.4 Send single SMS to one Recipient Query 6
2.5 Send single SMS to multiple recipients Query 6
2.6 Send POST Request 7
2.7 SMS Sending Errors 8
2.8 Receive DLR from HTTP Interface 9
2.9 Credit Balance Query 9
2.10 Check Credit Balance Errors 9
3 XML Interface Specifications 10
4 SMPP Interface Specifications 11
5 API Interface 13
Page 2 of 15
Document Version1.0
1. Overview
This document is for those clients who want to develop business applications to integrate with Deewan
AlRasaile and make use of its facilities in handling different types of sending SMS.
These Interfaces provide the client’s with the ability to integrate with Deewan AlRasaile to send SMS .
It was designed to help developers be more productive and to be able to add SMS functionality to any
project efficiently. Below are the main interfaces for this integration purposes:
Page 3 of 15
Document Version1.0
2.2. Query Parameter Description:
Delivery Time Int Delays delivery of SMS to mobile device , The upper limit is 7 days ,or 10080
(Optional) here the SMS was received by our SMSC. minutes.
it's should be greater than 10 minutes
for best effect .Smaller time frames may
be delivered soon
MessageType String Either Text or Unicode: In case of Unicode: You should convert
(Required) Text: This is the default message type. To message text to UTF-16BE before sending it
send plain text messages. through URL
Unicode: Send UTF-16BE messages.
ValidityPeriod Int 1440 This format. Set value at X minutes to
(Optional) the period in minutes, minutes where the
SMS was (24 received by SMSC)The
message will not be delivered if it is still
queued in the SMSC after this period.
DlrUrl String If you want to receive DLR you have to
(Optional) setup your own http service on your own
servers.
And send service url to Deewan AlRasaile
interface in this parameter.
Page 4 of 15
Document Version1.0
2.3. HTTP Interface Response:
Interface will return JSON response .Response will be in below format:
{
"requestStatus": {
"RequestID":<number>,
"ClientMessageID": <text>,
"ResponseText": <text>
},
"invalidRecipients":<text>,
“notSentTryAgain”:<text>,
"errors": [
<number>,<text>
]
]
}
Where:
Property Description
RequestID Random generated ID for each request
ClientMessageID Id that customer send in the request, interface return it as is.
ResponseText Request status.
invalidRecipients CSV of all invalid mobile numbers in the request
notSentTryAgain CSV of all numbers that didn’t sent and you can try to send them again.
Errors List of errors that occur while handle request
Page 5 of 15
Document Version1.0
2.4. Send single SMS to one Recipient Query
Request Format:
https://ht.deewan.sa:8443/Send.aspx?UserName=uuuu&Password=ppp&MessageType=text&Recipie
nts=1111111111111&SenderName=sss&MessaqeText
Response Format :JSON
{
"requestStatus": { "RequestID": 854289307,
"ClientMessageID": 10,
"ResponseText": "Request Handled Successfully"
},`
"invalidRecipients": "", “notSentTryAgain”: "", "errors": []
}
Request Format:
https://ht.deewan.sa:8443/Send.aspx?UserName=uuu&Password=ppp&MessageType=text&Recipients=96650
0000000,966561111111&SenderName=ssss&MessageText=mmmm
Page 6 of 15
Document Version1.0
2.6. Send POST Request
Example in C:#
var request = (HttpWebRequest)WebRequest.Create(" https://ht.deewan.sa:8443/send.aspx");
var postData=
"UserName=uuu&Password=ppp&MessageType=text&Recipients=966555555555&SenderName=sss
s&MessageText=example";
var data = Encoding.ASCII.GetBytes(postData); request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
var response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
Page 7 of 15
Document Version1.0
2.7. SMS Sending Errors
In the aforementioned queries ,if invalid or empty parameters were passed in the HTTP request a list
of defined errors will be returned as explained below:
Page 8 of 15
Document Version1.0
2.8. Receive DLR from HTTP Interface
To receive DLR from HTTP interface you should do the following:
On your premises, develop http service to parse the parameters of GET request, let say it will
be:
o www.account.com/dlr.aspx.
https://ht.deewan.sa:8443/BalanceQuery.aspx?UserName=xxxx&Password=xxxx
Response Example:
Credit=xxxxxxxx
___________________________________________________________________________________________
Page 9 of 15
Document Version1.0
3. XML Interface Specifications
In the XML interface the client can post XML file with certain schema to pass the required parameters.
XML File Sample:
Page 10 of 15
Document Version1.0
4. SMPP Interface Specifications
Deewan AlRasaile offers SMPP version 3.4 interface. Accordingly, when using the SMPP interface the
connection between your application and Deewan AlRasaile will be through SMPP version 3.4.
The default data coding data_coding = 0 for GSM 03.38 data coding
data_coding = 8 for UCS-2 data coding
maximum number of characters per message for data_coding = 0 is 160 character
maximum number of characters per message for data_coding = 8 is 70 character
Send Long Messages:
Client can use one of the following options:
Client send message partitioning with UDH included for each part, UDHI should be set in
esm_class
Client send message partitioning with sar_msg_ref_num, sar_total_segments,
sar_segment_seqnum TLV parameters set for each part
Client send message without partitioning using message_payload TLV parameter and Deewan AlRasaile will
handle message partitioning for you (used with Deewan AlRasaile managed)
Parameter Description
Username Provided for each client
Password Provided for each client
IP address SMSC SMPP interface IP (smpp.kh.deewan.sa) or (smpp.ruh.deewan.sa)
Port A port from the set of available ports will be provided to the client
Session Type Transmitter, Receiver, or Transceiver
Number of Sessions:
Deewan AlRasaile provide each SMPP client account with a number or a maximum of sessions in which the
client could connect to simultaneously to ease the messages transmission process.
PDUs Supported:
bind_transmitter, bind_reciever, bind_transciever, unbind, submit_sm, enquire_link
Page 11 of 15
Document Version1.0
Commend Response Description
ENQUIRE_LINK ENQUIRE_LINK_RESP To keep session alive
SUBMIT_SM SUBMIT_SM_RESP Submit response
BIND_TRANSCEIVER BIND_TRANSCEIVER_RESP Binding transceiver response
BIND_TRANSMITTER BIND_TRANSMITTER_RESP Binding transmitter response
BIND_RECEIVER BIND_RECEIVER_RESP Binding receiver response
UNBIND UNBIND_RESP Unbinding response
Submit Response:
As to confirm receiving ,the messages from our clients our gateway sends submit response confirmation
message for the client application once message is received.
DLR Support:
Client will receive delivery report only if your route provider supports delivery reports .If provider supports
delivery report ,reports will be sent to you equal the sent messages .In order to be able to receive the reports
you should set registered_delivery value to 1 for each SUBMET_SM PDU and either bind with Receiver or
Transceiver session.
DLR Format:
Deewan AlRasaile provide the delivery report to the client with the below format:
id:{message_id} sub:001 dlvrd:001 submit date:{date} done date:{date}
err:{error_code} text:{msg}
DLR TLV parameters:
Deewan AlRasaile provides the delivery report to the client with TLV
parameters receipted_message_id
message_state
Page 12 of 15
Document Version1.0
5. API Interface:
Sign In:
To sign-in using the Sign-In API, first submit an HTTP Request with your username and API Key, then
receive a Response that includes your access-token, which you will then provide in the authorization
header of each Deewan AlRasaile API request you need to submit.
https://api.deewan.sa:8445/deewan/api/v1/signin
BODY PARAMS:
apiKeystring
userNamestring
using your APIKEY, you can generate your access token.
Messaging:
Launch your mobile marketing campaign using our Messaging API Services. Send
advertisements as SMS messages to your customers or send an SMS notification to one of
your customers for a certain purpose.
First, use the Send Single or Bulk SMS API to send your message, or send an SMS to a
predefined group of recipients using the Send SMS to Groups API, then use the returned SMS
ID to track and view the sent message details by calling the Get Message Details by ID API.
After sending a sum of messages, you can track the messages you sent during a certain period
by calling Get Messages Details Within Date Range API. You may also want to learn the count
of these messages through the Get Sent Messages Count API.
Send Messages:
Through Deewan AlRasaile Send Single or Bulk SMS API, you can send a message to multiple
recipients or to a single recipient.
When you send SMS messages using this API, the API will return to you the sent messages’
ID to track them later using Deewan AlRasaile Get Message Details by ID API.
Using Deewan AlRasaile Send Single or Bulk SMS API is quite simple. First, submit an HTTP
Request with the message text and other important parameters, and then receive a Response
that includes the SMS ID.
https://api.deewan.sa:8445/deewan/api/v1/messaging
Page 13 of 15
Document Version1.0
BODY PARAMS:
Page 14 of 15
Document Version1.0
Send Message
Send an SMS with a verification passcode of six digits to your user’s phone number, so as to
verify your user identity, and that the given phone number is valid.
https://api.deewan.sa:8445/deewan/api/v1/destinations/verification
Validate Message
Compares the received passcode from your user with the check code returned from the Verify
Phone Number API. If the codes match, then the passcode is validated, and the user’s phone
number is successfully verified.
Page 15 of 15
Document Version1.0