Download OpenAPI specification:Download
A callback is an HTTP POST request with a notification made by the Sinch SMS REST API to a URI of your choosing.
The REST API expects the receiving server to respond with a response code within the 2xx
Success range. If no successful response is received, the REST API will either schedule a retry, if the error is expected to be temporary, or discard the callback, if the error seems permanent. The first initial retry will happen 5 seconds after the first try. The next attempt is after 10 seconds, then after 20 seconds, after 40 seconds, after 80 seconds, doubling on every attempt. The last retry will be at 81920 seconds (or 22 hours 45 minutes) after the initial failed attempt.
The SMS REST API offers the following callback options which can be configured for your account upon request to your account manager.
An inbound message is a message sent to one of your short codes or long numbers from a mobile phone.
To receive inbound message callbacks, a URL needs to be added to your REST API. This URL can be specified in your Dashboard.
The incoming Message to your sinch number
type | string The object type. Either mo_text or mo_binary. |
id | string The ID of this inbound message. |
from | string The phone number that sent the message. |
to | string The Sinch phone number or short code to which the message was sent. |
body | string The message body. Base64 encoded if type is |
client_reference | string If this inbound message is in response to a previously sent message that contained a client reference, then this field contains that client reference. Utilizing this feature requires additional setup on your account. Contact your account manager to enable this feature. |
operator_id | string The MCC/MNC of the sender's operator if known. |
send_at | string <date-time> When the message left the originating device. Only available if provided by operator. Formatted as ISO-8601: YYYY-MM-DDThh:mm:ss.SSSZ |
received_at | string <date-time> When the system received the message. Formatted as ISO-8601: YYYY-MM-DDThh:mm:ss.SSSZ |
A 200 status indicates that the data was received successfully.
{- "type": "mo_text",
- "id": "01XXXXX21XXXXX119Z8P1XXXXX",
- "from": "16051234567",
- "to": "13185551234",
- "body": "This is a test message.",
- "operator_id": "string",
- "send_at": "2022-08-24T14:15:22Z",
- "received_at": "2022-08-24T14:15:22Z"
}
A delivery report contains the status and status code for each recipient of a batch. To get a delivery report callback for a message or batch of messages you need to set the delivery_report
field accordingly when creating a batch.
The callback URL can either be provided for each batch or provisioned globally for your account in your Dashboard.
Return a 200 status to indicate that the data was received successfully
{- "type": "delivery_report_sms",
- "batch_id": "01FC66621VHDBN119Z8PMV1QPQ",
- "total_message_count": "20000",
- "statuses": [
- {
- "code": 0,
- "status": "Delivered",
- "count": 19999
}, - {
- "code": 401,
- "status": "Dispatched",
- "count": 1
}
]
}