Sending SMS to an Optin Group
To send an SMS to an optin group,one must create a optin group and keyword associated with it in your account. Also, need to add numbers for those optin keywords to a group i.e. optin group. An API for sending an SMS to an optin group should be in the following format:
curl -X POST \
'<BASE_URL>&method=optin&sender=AAAAAA&message=optin%20test&name=ssss'
API Parameter Specifications
The API parameter specifications are described in the following sections.
Mandatory Parameters
The mandatory parameters in the HTTP API are tabulated below:
| Parameter | Description | Expected Values |
|---|---|---|
| BASE_URL | URL of your SMS Service | URL |
| method | Predefined method | optin |
| sender | Sender ID assigned to your account | Sender ID |
| id/name | id-optin group ID/name-Optin keyword | comma separated id or optin group keyword |
| message | Message to be sent | Message text which is URL encoded(1000 char for normal, 500 for unicode) |
Optional Parameters
The optional parameters in the HTTP API are tabulated below::
| Parameter | Description | Expected Values |
|---|---|---|
| time | Date and time for scheduling an SMS | EX Format: YYYY-MM-DD HH:MM:SS OR YYYY-MM-DD HH:MM AM/PM |
| unicode | To specify that the message to be sent is in unicode format. Also can be used for automatic detection of unicode SMS. | 1 / 0 / auto |
| flash | To specify that the message is to be sent in the flash format | 1 or 0 |
| format | Output format should be as specified by this variable | XML/PHP/JSON/JSONP. Default response will be in JSON |
| callback | Callback function for JSONP response format | String |
Example Responses
- JSON
{
"status": "OK",
"data": {
"0": {
"id": "4422177667:1",
"customid": "",
"customid1": "",
"customid2": "",
"mobile": "971xxxxxxx",
"status": "AWAITED-DLR"
},
"1": {
"id": "4422177667:2",
"customid": "",
"customid1": "",
"customid2": "",
"mobile": "88xxxxxxx",
"status": "AWAITED-DLR"
},
"2": {
"id": "4422177667:3",
"customid": "",
"customid1": "",
"customid2": "",
"mobile": "95xxxxxxx",
"status": "AWAITED-DLR"
},
"group_id": 4422177667
},
"message": "Campaign of 3 numbers Submitted successfully."
}
Expected Error Codes:
| Status | Message |
|---|---|
| A430 | Group name/id missing |
| A431 | Group is empty |
| A432 | Invalid mobile number |
| A433 | Keyword name/number missing |
| A434 | Keyword not found |
| A435 | Keyword is not active |
| A436 | No sender found! |
Error Response
{
"status": "ERROR",
"code": "A431",
"message": "Group is empty"
}
Response Data
| Field | Description |
|---|---|
| status | It indicates the success or failure of your request. |
| message | It indicates the success or failure message. |
| group_id | Website group id for your reference which is the current date |
| data | All the response is wrapped in side data |
| optin | Each number will be wrapped inside optin group |
| id | Website message id for your reference |
| customid | Custom message id if you provide one |
| customid1 | Custom message id 1 if you provide one |
| customid2 | Custom message id 2 if you provide one |
| mobile | Mobile number the sms will be sent |
| status | status of the message |