SMS Gateway REST API

Samples

Samples

Simplest request

{
    "destinations": [
        {
            "number": " 35678000000 "
        }
    ],
    "sms_content": {
        "message": "This is a real test message to say hello."
    }
}

 

What it does:
  • The message will be delivered to a single mobile number.
  • Since a sender ID or route were not specified, the default values associated to the token declared within the HTTP header will be used.
  • A callback will NOT be sent since a callback URL was not specified
  • Encoding used will be GSM7 (default)

 

Request with multiple destinations and multipart (GSM7)

{
    "destinations": [
        {
            "number": " 35676000000 ",
            "custom_id": "ce0003"
        },
        {
            "number": " 35676000001 ",
            "custom_id": "ce0004"
        }
    ],
    "sms_content": {
        "message": "This is a real test message to say hello. This now is also a much longer message that will span over multiple pages if long enough. I will keep typing until I exceed the 160 character mark. OK done. End of message.",
        "encoding": "GSM7",
        "sender_id": "MyCompany"
    },
    "callback_url": "http://192.168.11.31/sms_callback.php",
    "ttl": 600,
    "job_id": "job1124"
}

 

What it does:
  • The message will be delivered to two mobile numbers, as described within the destinations block.
  • Messages will appear to be sent from “MyCompany”.
  • A call-back will be sent to the web service given by callback_url./li>
  • Encoding used will be GSM7 (default).
  • Job ID “job1234” will be echoed in the call-back for your reference, as will the customer ID per message.
  • As a route was not specified, it will be defaulted from token.
  • Fortytwo will attempt to send the message for 10 minutes, since the TTL was set to 600 seconds

 

Request with binary message

{
    "destinations": [
        {
            "number": "35678000000"
        }
    ],
    "sms_content": {
        "message": "pAYBrgIFagBFxgwDZm9ydHl0d28uY29tAAEDZm9ydHl0d28gd2Vic2l0ZQABAQ==",
        "encoding": "BINARY",
        "sender_id": "MyCompany",
        "udh": "BgUEC4Qj8A==",
        "pid": 65
    }
}

 

What it does:
  • The message will be delivered to a single mobile number
  • Route, plan and sender ID defaulted from token
  • Callback URL specified.
  • Route defaulted from token
  • Sender ID overridden

 

Request with custom Key-Value replacements in message per destination

{
    "destinations": [
        {
            "number": "35676000000",
            "custom_id": "test12238",
            "params": {
                "NAME": "Clifford",
                "AGE": "23"
            }
        },
        {
            "number": "35676000001",
            "custom_id": "test12234",
            "params": {
                "NAME": "Clyde",
                "AGE": "37"
            }
        }
    ],
    "sms_content": {
        "message": "Hello {#NAME}, you are {#AGE} year(s) old. Bye {#NAME}.",
        "encoding": "GSM7",
        "sender_id": "MyCompany"
    },
    "callback_url": "http://192.168.11.31/sms_callback.php"
}

 

What it does:
  • This message will be Multiple destinations (MSISDSNs)
  • Custom key/value pairs are specified per destination to send a custom message per recipient
  • Messages will appear to be sent from “MyCompany”.
  • A call-back will be sent to the web service given by callback_url.
  • Encoding used will be GSM7.

Sample Response

{
    "api_job_id": "56af1583-18e9-4753-a3d3-8010699d7a59",
    "results": {
        "35676000000": {
            "message_id": "14480365533520013403",
            "custom_id": "test12238"
        },
        "35676000001": {
            "message_id": "14480365533540023403",
            "custom_id": "test12234"
        }
    }
}

Sample Callback

{
    "api_job_id": "f6ec6eb7-e4d6-4c93-bcc5-a41443853662",
    "client_job_id": "123456",
    "data": [
        {
            "type": "SMS",
            "message_id": "14289193162160024003",
            "status": "UNDELIV",
            "timestamp": 1428919327,
            "micro_timestamp": 1428919327000,
            "to": "35678000000",
            "from": "fcm",
            "client_message_id": "test12234",
            "error_code": 952
        }
    ]
}
Get Started