Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Notify delivery callbacks



What is a Notify delivery callback?

what-is-a-notify-delivery-callback page anchor

A Notify delivery callback is a URL that sends webhooks that provide you with information about how many messages were sent and if those messages were sent correctly by the Notify API. Let's keep in mind that Notify is a bulk-first messaging API, where one API call can trigger from zero to multiple thousands of messages.

(information)

Info

Note: Each Callback will contain the status for up to 1000 SMS and/or pushes.

What information is reported in delivery callbacks?

what-information-is-reported-in-delivery-callbacks page anchor

Every callback contains a list of the deliveries-messages that were sent as part of the notification.

The status of one notification can be delivered in one or multiple delivery callbacks, depending on the size of the notification. The final callback from the Notify API will always have a flag IsFinal set to True to indicate that notification is handled completely.

Every delivery in the list has one of the following status:

  • SENT: Notify successfully passed the message to the channel (i.e. Twilio SMS, FCM, APN)
  • FAILED: The channel (Twilio SMS, FCM, APM) returned an error.
(warning)

Warning

Notify callbacks do not update the state of the message once it has been passed to the channel. It means there will be no further updates when a recipient has received a message.

Notify delivery callback provides the following payload information.

ParameterTypeDescription
NotificationSidstringA 34 character string that uniquely identifies the Notification that triggered the Delivery attempt
AccountSidstringThe unique ID of the Account that sent this notification
ServiceSidstringThe unique ID of the Service that sent this notification
CountintegerNumber of Deliveries in this report
SequenceIdintegerSequence number of the batch starting from 0
IsFinalbooleanFlag to indicate it is the final batch for the bulk notification
DeliveryStateJSONThe status of this Delivery attempt

Data format for DeliveryState

data-format-for-deliverystate page anchor

The DeliveryState indicates the status of a delivery attempt. The number of performed delivery attempts should be equal to the number of DeliveryState parameters shown in the payload.

ParameterTypeDescription
sidstringProvider unique message id (for APN/FCM) or message sid (SMxxx for SMS, MMxxx for MMS, RUxxx for rest of adapters)
typestringChannel type (e.g., APN, FCM, SMS, etc...)
statusstringSENT or FAILED
identitystringIdentity
error_codeInteger (optional)Twilio error code, if an error happened. For more information, go to Twilio error codes

Content-Type: application/x-www-form-urlencoded


_10
&SequenceId=0
_10
&NotificationSid={NotificationSid}
_10
&IsFinal=False
_10
&Count=2
_10
&DeliveryState[0]="{ \"sid\": \"message sid\", \"channel\": \"APN\", \"status\": \"SENT\" }"
_10
&DeliveryState[1]="{ \"sid\": \"message sid\",
_10
\"channel\": \"APN\",
_10
\"status\": \"FAILED\",
_10
\"error_code\": 52131,
_10
\"error_message\": \"The provided APNs device token has been unregistered\" }"

How to subscribe to the status callback?

how-to-subscribe-to-the-status-callback page anchor

The Notification's resource accepts an optional "DeliveryCallbackUrl" field that should contain a URL that will be called to provide the Notification status, as shown in the following example:


_10
curl -X POST 'https://notify.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications' \
_10
--data-urlencode 'Identity=00000001' \
_10
--data-urlencode 'Body=Hello Bob' \
_10
--data-urlencode 'DeliveryCallbackUrl=https://myhost/notifyCallbacks'
_10
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN


Rate this page: