Send SMS Messages

Send SMS messages through a GSM/3G/4G trunk.

Scenario: When you phone to your carrier to apply for a calling plan, you hear an IVR and press a specific key on your phone as instructed to request detailed information. As a result, a text message is sent to your phone shortly after it is required.

Note: A text message have a maximum length of 2000 characters and no emoji should be included.

Endpoint

POST /api/v1.1.0/sms/send?token={token}

Request Parameters

Name Importance Type Description
phonenumber Required String Phone number.
message Required String Encoded message content.
trunk Required String Use which GSM/3G/4G trunk to send the SMS.

Response Parameters

Name Type Description
action Object Result.
status String Message Sending status:
  • Success.
  • Failed.
smsid String A unique identifier for the SMS.

Examples

Request Example
Note: The SMS messages should be URL encoded. You can encode the message to URL on this website.
POST /api/v1.1.0/sms/send?token=1e3b3ebb6a974cb42ed31de5413df52d HTTP/1.1
Content-Type:application/json; charset=utf-8
Host: 192.168.5.150
{
    "trunk": "GSM",
    "phonenumber": "18396210850",
    "message": "%E4%BD%A0%E5%A5%BD"
}
Response Example

Request successful.

HTTP/1.1 200 OK
Access-control-allow-origin: *
Access-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE
{
    "status": "Success",
    "smsid": "18396210850-1502874159"
}
  • Message Successfully Sent

    HTTP/1.1 200 OK
    Access-control-allow-origin: *
    Access-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE
    {
        "action": "sms-send",
        "status": "Succeed",
        "smsid": "18396210850-1502874445"
    }
  • Message Sending Failed

    HTTP/1.1 200 OK
    Access-control-allow-origin: *
    Access-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE
    {
        "action": "sms-send",
        "status": "Failed",
        "smsid": "18396210850-1502874159"
    }
Request failed
HTTP/1.1 200 OK
Access-control-allow-origin: *
Access-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE
{
    "status": "Failed",
    "errno": "20004"
}