This document explains about how to use our SMS API. In order to send an SMS you need to use an HTTP post request by sending an XML stream. The response will also be sent in an XML Format.
All requests must be sent to https://app.smsleads.co.il/api
All responses will be according to the command request, but all look something like this:
0SMS will be sentxxxxxxx
The status field differs according to the result. when status is zero the request is valid and for any error the status number is the error number.The message also differs when the status is not zero, to explain the reason. The root element "sms" will change according to the command sent.
Get API Token
Before start using SMS LEADS API, you need your account Username and Password as you got to your mailbox while register to the service.
You can reset your accounts Password by forgot password button on login screen.
In order to use the SMS LEADS API services, generate API TOKEN is needed.
After gathering all the information – it's time to get a token.
Then, fill out the form and SUBMIT. You will get the API TOKEN and Expiration Date.
After receiving the token – the token should be added to the header as “Bearer authentication” when the key is "Authorization" in every single method used.
The Token valid for 24 month, after this period you should generate a new one.
When generating a new TOKEN the old one still valid for next 7 days to allow you make the change in your system.
We will notice by email and SMS while period is about to end.
1. Send
1.1 Send SMS
In order to send an SMS message you must send an XML similar to the following example:
JohnDoeDemoAPI21518215005xxxxxxxx5xxxxxxxx5xxxxxxxx5xxxxxxxx#This is a sample message030/03/21 10:1000
Fields:
sms – Required element. Contains all other elements.
user – Required element. Contains all user elements.
username – Required element. The username of the account by which you are recognized in the system.
source – Required element. The phone number from which you wish to send the SMS message. Must be maximum 11 characters and contains only numeric value (no + sign) and English letters
destinations – Required element. Contains all phone destinations you wish to send the SMS to. May contain multiple phone fields.
phone – Required element. phone number to which the SMS, must be formatted: 5xxxxxxx or 05xxxxxxx
id – Optional attribute. An attribute of the phone element. If you’re interested in checking for DLR’s enter your ID for the SMS to query it later. Leave blank or don’t add it if you’re not interested.
Tag- Optional element . basically for GOOGLE's automatic SMS verification users ,allows you to add tag to the beginning of the message ,for example: #Hello world result=> "<#>Hello world"
Add_dynamic- Optional element. If you wish that the SMS will send with the Dynamic Field of the contact list, set 1, any other value would be considered as no. This will check that there are no singles tags in the XML an no more than 1 tag, • To use dynamic field, you need to use the following template: [DYNAMIC_FIELD1] for the first dynamic field and so on. For example: Hello [DYNAMIC_FIELD1] [DYNAMIC_FIELD2]
message – Required element. Contains the message to be sent to the destinations.
timing – Optional element. the date in which the sms to be sent. If absent then will send immediately.
response – Optional element. If you wish that the SMS will have response functionality set 1, any other value would be consider as no. This will have a random "source" number attached to the SMS and the value you wrote will be ignored. • Add_unsubscribe – Optional element. If you want to add SMS option for removal. Remove by link set 3, Remove by return SMS set 2, any other value would be considering as no.
cl_id – Optional element. If you wish send a message to a contact lists. You should enter the ID of the contact list.
In which the response will be something like:
0SMS will be sentxxxxxxx
1.2 Send bulk SMS
You also have the option to send bulk SMS, which means you can send multiple individual SMS messages, in which case the XML will be something like:
JohnDoeDemoAPI5xxxxxxxx5xxxxxxxx5xxxxxxxx5xxxxxxxxThis is a sample messageDemoAPI5xxxxxxxxThis is a different message sent10/10/17 10:100
In which the response will look something like:
00SMS bulk will be sentxxxxxxx
response – Optional element. If you wish that all the SMS messages will have response functionality set 1, any other value would be consider as no. This will have a random "source" number attached to every SMS (same number to all of them) and the value you wrote will be ignored.
add_unsubscribe – Optional element. If you want to add SMS option for removal. Remove by link set 3, Remove by return SMS set 2, any other value would be consider as no.
2. More actions
2.1 Get balance
If you wish to check your remaining balance send an XML similar to the following example:
JohnDoe
Fields:
balance- Required element. Contains all other elements.
user – Required element. Contains all user elements.
username – Required element. The username of the account by which you are recognized in the system.
In which the response will be something like:
0Your balance is:4242
2.2 Get delivery reports (DLR)
2.2.1 Get delivery reports (DLR) basic
In order to get Delivery reports you must send an XML similar to the following example:
JohnDoesome id 1some id 201/01/21 00:0001/01/21 23:59
Fields:
dlr- Required element. Contains all other elements.
user – Required element. Contains all user elements.
username – Required element. The username of the account by which you are recognized in the system.
transactions – Required element. Contains all sms destinations you wish to receive DLR’s for. May contain multiple external_id fields.
external_id – Required element. The id you have sent as an attribute while submitted the SMS.
message – Required element. Contains the message to be sent to the destinations.
from* – Required element. The start date to take DLR’s from. Format: dd/mm/yy hh:mm
to*- Required element. The end date to take DLR’s from. Format: dd/mm/yy hh:mm
* The date range that is allowed to pick from is a range of 1 week up to 1 year back .
* The max limit of DLR's in each request is 1000.
In which the response will be something like:
01391438285102הגיע ליעד Delivered03/02/21 16:38123456781391438286102 הגיע ליעד Delivered03/02/21 16:3812345678
2.2.2 Get Delivery reports by date(dlrByDate)
In order to get Delivery reports without external id you must send an XML similar to the following example:
JohnDoenull01/01/21 00:0001/01/21 23:59
Fields:
dlrByDate- Required element. Contains all other elements.
user – Required element. Contains all user elements.
username – Required element. The username of the account by which you are recognized in the system.
transactions – Required element. Contains all sms destinations you wish to receive DLR’s for. May contain multiple external_id fields.
external_id – Required element. Can contain a value of null.
message – Required element. Contains the message to be sent to the destinations.
from* – Required element. The start date to take DLR’s from. Format: dd/mm/yy hh:mm
to*- Required element. The end date to take DLR’s from. Format: dd/mm/yy hh:mm
The date range that is allowed to pick from is a range of 1 week up to 1 year back
2.3 Get Incoming SMS
In order to get Incoming reports you must send an XML similar to the following example:
JohnDoe01/01/15 00:0001/01/15 23:59
Fields:
user – Required element. Contains all user elements.
username – Required element. The username of the account by which you are recognized in the system.
from* – Required element. The start date to take DLR’s from. Format: dd/mm/yy hh:mm
to*- Required element. The end date to take DLR’s from. Format: dd/mm/yy hh:mm
*The date range that is allowed to pick from is a range of 1 week up to 1 year back In which the response will be something like:
005********05********This is a sample message03/12/21 16:3805********05********This is a test message03/12/21 12:33
2.4 Blacklist
2.4.1 Get blacklist
If you would like to check your blocked list, please submit XML similar to the following example:
JohnDoe02/06/15 00:0015/12/15 23:59
Fields:
blacklist- Required element. Contains all other elements.
user – Required element. Contains all user elements.
username – Required element. The username of the account by which you are recognized in the system.
from* – Required element. The start date to take DLR’s from. Format: dd/mm/yy hh:mm
to*- Required element. The end date to take DLR’s from. Format: dd/mm/yy hh:mm
In which the response will be something like:
05********03/12/21 16:385********03/12/21 12:33
2.4.2 Remove phones from blacklist
If you wish to remove phones from blacklist an XML similar to the following example:
xxxxxx5********05********Text here
Fields:
rmNumBL – Required element. Contains all other elements.
user – Required element. Contains all user elements.
username – Required element. The username of the account by which you are recognized in the system.
phones- Required element. Contains all phone elements.
phone- Required element. Contains phone you want to remove.
reason- Required element. Contains an text about the reason why you want to remove.
In which the response will look something like:
Success:
944X phone numbers Successfully deleted , Y Phone numbers not exist in blacklist
Fail:
933Phones or reason not valid
2.5 Subscribers
2.5.1 Add subscriber
If you wish to add subscriber an XML similar to the following example:
xxxxxx israel israeli israelisraeli israelisraeli 05xxxxxxxx70000
Fields:
addSub – Required element. Contains all other elements.
user – Required element. Contains all user elements.
username – Required element. The username of the account by which you are recognized in the system.
userDetails- Required element. Contains the Details of the user that you want to start.
Name – Required element. Contains the name you want to give the user
Username- Required element. Contains the username you want to give the user.
Password- Required element. Contains the password you want to give the user.
source- Required element. Contains the source you want to give the user. Default.
amount – Required element. Contains the amount of credits you want to give the user. Contain only digits
In which the response will look something like:
0The user was created successfully
2.5.2 Update subscribers wallets
If you wish to update the wallet of subscribers an XML similar to the following example:
xxxxxx username1password170000
Fields:
updateAmountSub- Required element. Contains all other elements.
user – Required element. Contains all user elements.
username – Required element. The username of the account by which you are recognized in the system.
userDetails- Required element. Contains the Details of the user that you want to update.
Username- Required element. Contains the username you want to update subscriber.
Password- Required element. Contains the password you want to update subscriber.
amount – Required element. Contains the amount of credits you want to give the user. Contain only digits.
In which the response will look something like:
0Wallet successfully updated
2.5.3 Get the balance of all subscribers
If you wish to get the balance of all subscribers an XML similar to the following example:
xxxxxx
Fields:
getBlanceSubs – Required element. Contains all other elements.
user – Required element. Contains all user elements.
username – Required element. The username of the account by which you are recognized in the system.
In which the response will look something like:
080xxxname150xxx name2
2.6 Contact lists
2.6.1 Create contact list
If you wish to create contact list an XML similar to the following example:
* Status code 0 means successful transaction. Will contain a positive message according to the API command sent. Example: "SMS will be sent" **Status code 2 means that one of the XML fields was missing. The message would say what field is missing.