Message status changes occur throughout the lifecycle of an outbound message from creation, through sending, to delivery, and even read receipt for supporting messaging channels.
Twilio allows you to programmatically track these status changes for outbound messages sent with Programmable Messaging through the use of status callbacks.
This guide explains for which changes in outbound message status Twilio sends status callback requests.
The provided information applies to:
If your use case involves the sending of high volumes of messages or message scheduling, you may use a Messaging Service. Use of a Messaging Service has implications for the relevant message status changes as described in the following sections.
When you create a Message resource for an outbound message, it is created with an initial status
value.
The following two tables show this initial status
value, depending on how you created the Message:
Message created without a Messaging Service: |
---|
queued |
Message created with a Messaging Service | |
---|---|
for immediate sending (non-scheduled): accepted | for scheduled sending at a later time: scheduled |
A status callback request is not sent for the initial status
of a newly created Message resource.
If you use the REST API to create the Message Resource, you can obtain the initial status
value from the API response to the create action.
Twilio sends status callback requests when the Message resource's status
changes after creation.
The diagram below shows the status
transitions of outbound messages for which Twilio sends a status callback request. The Message resource API Reference contains the full list of possible status values and their descriptions.
If you used a Messaging Service to create the message, then
An accepted
(non-scheduled) or scheduled
message transitions to queued
status once the following two conditions are met:
SendAt
time has been reached.
From
sender out of the Messaging Service's Sender Pool on Message creation.
queued
.
scheduled
message can be canceled before its
SendAt
time. In this case a status callback request is emitted with status
canceled.
After queuing, Twilio sends status callback requests as follows, regardless of how the message was created,
sent
, otherwise
failed
delivered
, otherwise
undelivered
If the messaging channel through which the message was sent supports read receipts, the Message resource may finally reach read
status, provided the message recipient has read receipts enabled on their device (currently WhatsApp only).
Now that you know when Twilio sends status callback requests triggered by outbound message status changes, check out the following resources: