The SMS API supports the following:
POST
- When you send a POST request with the end user’s phone number to the messaging subresource, We sends the SMS message you specify.
Types of services and their values are listed below:
Country code is mandatory to be included in the to
paramenter for global messaging and optional for indian numbers. If country code not found, default 91
will get appended to mobile number.
Before you start sending transactional SMS through this API, please test whether your content is matching a template which has been pre approved. Otherwise, the SMS will end up being rejected.
Now you can send message using template id of the predefined template created in your account.
Example template as follows:
Dear {{1}}, Thanks for registering with us. Your details as follows {{2}}, {{3}}.
While sending sms we need to pass the variables in the api url then content will be replaced automatically in the template as below.
Ex: variables=["laxman","laxman46XXXXXX@gmail.com","891952XXXX"]
Note: Variables in array must be in order created in template. Even blank values also will replace if we specify in variables array.
```
Dear laxman, Thanks for regisitering with us. Your details as follows laxman46XXXX@gmail.com, 891952XXXX.
```
{endpoint}sms/template?access_token=d9e1cac3812186b353c50xxxxxxx
You can send sms using POST
method content in body.
All params in send sms will support in JSON also.
{
"service": "T",
"template_id": "008ed156-61b1-4582-aa8e-0f4068776c2e",
"variables" : ["Laxman", "", "New"],
"to": ["91891952xxxxx","918919xxxxxx"]
}
Name | Descriptions |
---|---|
to | Phone number to send with country prefix. (multiple numbers need to be sent as array.) |
template_id | Id of the template |
service | Determines whether the SMS to be sent is Transactional, Promotional or other. |
variables | Varible values for replacing in template content (need to send as array) Ex:[“name”,“891919XXX”,“new”] |
Name | Descriptions |
---|---|
name | Name of the campaign |
dlr_url | The Url for which the SMS response to be sent after sending the SMS can be specified using this parameter. read more |
time | Schedule time (in format i.e,yyyy-mm-dd hh:mm:ss) at which the SMS has to be sent. |
type | The SMS to be sent is Unicode, Normal or Auto detect. (value “U”, “N” or “A”) |
flash | This parameter can be used to send flash sms via API ( Values 1 or 0.) |
custom | Any customised parameters can be passed using this parameter |
custom1 | Any customised parameter |
port | Port number to which SMS has to be sent |
curl -X POST \
'http://portal.mobtexting.co/api/v2/sms/template?access_token=d9e1cac3812186b353c50xxxxxxx' \
-H 'content-type: application/json' \
-d '{
"service": "T",
"template_id": "008ed156-61b1-4582-aa8e-0f4068776c2e",
"variables" : ["Laxman", "myname@gmail.com", "New"],
"to": ["918919525224","8919555555"]
}'
{
"status": 200,
"message": "2 numbers accepted for delivery.",
"data": [
{
"id": "06a1880f-2396-42e7-a141-06fa3a9b23bf:1",
"mobile": "9189195xxxx",
"status": "AWAITING-DLR",
"units": 1,
"length": 152,
"charges": "1.0000",
"customid": "",
"customid1": "",
"iso_code": null,
"submitted_at": "2020-09-24 15:42:56"
},
{
"id": "06a1880f-2396-42e7-a141-06fa3a9b23bf:2",
"mobile": "9189195xxxx",
"status": "AWAITING-DLR",
"units": 1,
"length": 152,
"charges": "1.0000",
"customid": null,
"customid1": null,
"iso_code": null,
"submitted_at": "2020-09-24 15:42:56"
}
]
}