JSON API » messages » messages/text/send
Sends a text message. The actual sending up is asynchronous, and will happen after the function returns.
Input parameters
Requires authentication and the send messages role privilege.
| Name | Type | Description | Required | Default value |
|---|---|---|---|---|
| auth_username | String | Authentication username. | Yes | |
| auth_password | String | Authentication password. | Yes | |
| cnumber | String | The destination to send the message to. | Yes | |
| message | String | The message to send. | Yes | |
| stype | String | "phone" to send from a telephone line, empty string to send from a number. | Recommended | Empty string. |
| snumber | String | The telephone line or number to send from. | Yes | |
| customer | Integer | ID of customer to send as. | No | Customer of authentication user. |
| filenameX | String | Name of file X. X should start from 1. First file will have parameter named as filename1 | No | |
| fileX | String | base64 encoded data for file number X | No |
The customer must own the sending number or telephone line.
Responses
| Code | Description |
|---|---|
| 204 | Message successfully submitted for sending. |
| 400 | Invalid input parameters specified. Check the key and message fields for more details. |
| 401 | The authentication details provided are invalid. |
| 402 | Your role does not allow this. |
| 403 | Your rate plan does not allow this. |
Data returned
No data is returned.
Example: Sending from a number
http://enswitch.example.com/api/json/messages/text/send/?auth_username=user;auth_password=password;stype=;snumber=2125550000;cnumber=2125551234;message=This%20is%20an%example%20message{ "responses":[ { "code":"204", "key":"", "message":"OK" } ] }
Example: Sending from a telephone line
http://enswitch.example.com/api/json/messages/text/send/?auth_username=user;auth_password=password;stype=phone;snumber=1234567;cnumber=2125551234;message=This%20is%20an%example%20message{ "responses":[ { "code":"204", "key":"", "message":"OK" } ] }
Change history
| Version | Changes |
|---|---|
| 4.2 | filenameX and fileX parameters added. |
| 3.13 | Function added. |
