Operations resource
Operations represents an asynchronous request that creates one or more resources, such as sending a message to multiple recipients. When you submit a Send Messages request, the API returns an operationId that you can use to monitor the status and progress of the operation.
The Operation ID is an identifier that can be used to correlate all of the resources created in a request.
Issue a GET request to the resource list location, using the Operation ID as a query parameter to retrieve the resources that correlate with the Operation.
comms_operation_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_operation_[0-7][a-hjkmnpqrstv-z0-9]{25,34}The status of an Operation.
SCHEDULEDPROCESSINGCOMPLETEDCANCELEDRepresents the stats of a sending operation of one or many communications resources, such as Messages and Emails.
-
totalis the total number ofMessagesin theOperation.-
To get the status for each individual
Message, fetch the resource with:GET /Messages/{messageId}. -
For group communications, where there is more than one recipient per communication resource use
Receiptse.g.GET /Messages/{messageId}/Receipts.
-
-
recipientsis the total number of recipients targeted in an Operation. -
attemptsis the total number of sending attempts made by Twilio. -
unaddressableis the number of recipients to which no sending attempts were made because a valid match could not be found between the available addresses for the recipient (to) and sender (from). -
scheduledis the number ofMessagesthat are scheduled to be sent by Twilio in the future. -
queuedis the number ofMessagesthat are queued in Twilio for sending. -
sentis the number ofMessagesthat have been sent by Twilio. -
deliveredis the number ofMessagesthat have been successfully delivered to recipients. -
readis the number ofMessagesthat have been read by recipients. -
undeliveredis the number ofMessagesthat were successfully sent by Twilio but have not been delivered to the recipient. -
failedis the number ofMessagesthat failed during processing by Twilio. GetErrorswithGET /Messages/Operations/{operationId}/Errorsfore more detail. -
canceledis the number ofMessagesthat were canceled via API request.
{"total":1,"recipients":1,"attempts":1,"queued":0,"sent":0,"scheduled":0,"delivered":0,"read":0,"undelivered":0,"unaddressable":0,"failed":0,"canceled":0}GET https://comms.twilio.com/v1/Messages/Operations/{operationId}
Retrieve an Operation by its ID, including its current status and aggregate delivery statistics.
comms_operation_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_operation_[0-7][a-hjkmnpqrstv-z0-9]{25,34}OK
Optional
The Operation ID is an identifier that can be used to correlate all of the resources created in a request.
Issue a GET request to the resource list location, using the Operation ID as a query parameter to retrieve the resources that correlate with the Operation.
comms_operation_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_operation_[0-7][a-hjkmnpqrstv-z0-9]{25,34}Optional
The status of an Operation.
SCHEDULEDPROCESSINGCOMPLETEDCANCELEDOptional
Represents the stats of a sending operation of one or many communications resources, such as Messages and Emails.
-
totalis the total number ofMessagesin theOperation.-
To get the status for each individual
Message, fetch the resource with:GET /Messages/{messageId}. -
For group communications, where there is more than one recipient per communication resource use
Receiptse.g.GET /Messages/{messageId}/Receipts.
-
-
recipientsis the total number of recipients targeted in an Operation. -
attemptsis the total number of sending attempts made by Twilio. -
unaddressableis the number of recipients to which no sending attempts were made because a valid match could not be found between the available addresses for the recipient (to) and sender (from). -
scheduledis the number ofMessagesthat are scheduled to be sent by Twilio in the future. -
queuedis the number ofMessagesthat are queued in Twilio for sending. -
sentis the number ofMessagesthat have been sent by Twilio. -
deliveredis the number ofMessagesthat have been successfully delivered to recipients. -
readis the number ofMessagesthat have been read by recipients. -
undeliveredis the number ofMessagesthat were successfully sent by Twilio but have not been delivered to the recipient. -
failedis the number ofMessagesthat failed during processing by Twilio. GetErrorswithGET /Messages/Operations/{operationId}/Errorsfore more detail. -
canceledis the number ofMessagesthat were canceled via API request.
{"total":1,"recipients":1,"attempts":1,"queued":0,"sent":0,"scheduled":0,"delivered":0,"read":0,"undelivered":0,"unaddressable":0,"failed":0,"canceled":0}Optional
Optional
1import { TwilioClient } from "twilio-comms";23async function main() {4const client = new TwilioClient({5accountId: "TWILIO_ACCOUNT_SID",6authToken: "TWILIO_AUTH_TOKEN",7});8await client.messages.fetchOperation("comms_operation_01h9krwprkeee8fzqspvwy6nq8");9}10main();
GET https://comms.twilio.com/v1/Messages/Operations
Retrieve a list of Operations. Use query parameters to filter results by status and date range.
Filter to Operations created after the specified date and time in ISO 8601 format.
Filter to Operations created before the specified date and time in ISO 8601 format.
Filter to Operations with the specified status.
SCHEDULEDPROCESSINGCOMPLETEDCANCELEDThe number of resources to return in a page.
50Example: 50Minimum: 1Maximum: 1000OK
Optional
A list of Message Operations.
Optional
Metadata for paginated results. This object contains two tokens to navigate through paginated results.
- Use
nextto retrieve the 'next' page in the result list. - Use
selfto retrieve the same page of the result list again. - Supply the token in the
pageTokenquery param.
1import { TwilioClient } from "twilio-comms";23async function main() {4const client = new TwilioClient({5accountId: "TWILIO_ACCOUNT_SID",6authToken: "TWILIO_AUTH_TOKEN",7});8await client.messages.listOperations({9startDate: new Date("2024-01-15T09:30:00Z"),10endDate: new Date("2024-01-15T09:30:00Z"),11status: "SCHEDULED",12pageToken: "pageToken",13pageSize: 50,14});15}16main();