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. For 5xx
the callback will be retried. For 429
the callback will be retried and the throughput will be lowered. For other status codes in the 4xx
range the callback will not be retried. 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.
Note that, with these callbacks, the Sinch SMS REST API will make a request to the URI of your choosing. This means that Sinch will be authenticating against your system. By making a request to your account manager, SMS REST API callbacks may be configured with the following options:
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
The page of inbounds matching the given filters.
body required | string [ 0 .. 2000 ] characters |
from required | string The phone number that sent the message. More info |
id required | string The ID of this inbound message. |
received_at required | string <date-time> When the system received the message. Formatted as ISO-8601: |
to required | string The Sinch phone number or short code to which the message was sent. |
type required | string Regular SMS |
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. |
sent_at | string <date-time> When the message left the originating device. Only available if provided by operator. Formatted as ISO-8601: |
A 2xx
status code indicates that the data was received successfully.
A 4xx
status counts as a permanent failure and will not trigger any retries, except for 429
.
The callback will be retried and the callback throughput will be lowered.
A 5xx
status code will trigger a retry.
{- "body": "This is a test message.",
- "from": "16051234567",
- "id": "01XXXXX21XXXXX119Z8P1XXXXX",
- "operator_id": "string",
- "received_at": "2022-08-24T14:15:22Z",
- "sent_at": "2022-08-24T14:15:22Z",
- "to": "13185551234",
- "type": "mo_text"
}
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, set the delivery_report
field accordingly when creating a batch.
The following is provided so you can better understand our webhooks/callbacks. Configuration of both webhooks and the type of delivery report requested happens when sending a batch.
The callback URL can either be provided for each batch or provisioned globally for your account in your Sinch Customer Dashboard. Learn how to configure a webhook/callback here.
The type
is the type of delivery report webhook. The response will vary depending on the webhook delivery report you selected when the batch was sent, so choose the appropriate selection under "One of".
delivery_report_sms
and delivery_report_mms
types are documented under Delivery report. These are reports containing either a full report or summary report, depending on your selection at the time the batch was sent.recipient_delivery_report_sms
and recipient_delivery_report_mms
delivery report types are documented under Recipient delivery report. These are delivery reports for recipient phone numbers. If you set per_recipient
for the delivery_report
parameter when sending the batch, a recipient report gets sent to you for each status change for each recipient in your batch. If you set per_recipient_final
, a recipient report gets sent to you for the final status of each recipient in your batch.A 2xx
status code indicates that the data was received successfully.
A 4xx
status counts as a permanent failure and will not trigger any retries, except for 429
.
The callback will be retried and the callback throughput will be lowered.
A 5xx
status code will trigger a retry.
{- "batch_id": "01FC66621XXXXX119Z8PMV1QPQ",
- "statuses": [
- {
- "code": 0,
- "count": 1,
- "recipients": [
- "44231235674"
], - "status": "Delivered"
}
], - "total_message_count": 1,
- "type": "delivery_report_sms"
}