Operations and Notification Tracking
An Operation represents a request that sends push notifications to one or more recipients. When you submit the request, the Push Notifications API validates the input and returns an HTTP 202 Accepted response that includes an operationId in the response body. Use the operationId value to monitor the status and progress of the Operation.
As the Operation is processed, it generates a PushNotification with an associated pushNotificationId for each recipient. Each PushNotification then creates at least one delivery attempt for each provider (FCM or APNs) that is tried.
Make a GET request with the Operation ID to retrieve its status.
1curl -X GET 'https://comms.twilio.com/v1/PushNotifications/Operations/{operationId}' \2--header 'Content-Type: application/json' \3-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Sample response:
1{2"id": "comms_operation_01h2xcejqtf2nbrexx3vqjhp41",3"status": "COMPLETED",4"stats": {5"total": 1,6"recipients": 1,7"attempts": 1,8"queued": 0,9"sent": 0,10"delivered": 1,11"undelivered": 0,12"failed": 013},14"createdAt": "2024-04-05T06:20:00Z",15"updatedAt": "2024-04-05T06:20:00Z"16}
See the Push Notifications Operations API reference.
Use the List PushNotifications endpoint to retrieve the PushNotification resources that an Operation created.
1curl -X GET 'https://comms.twilio.com/v1/PushNotifications?operationId={operationId}' \2--header 'Content-Type: application/json' \3-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Sample response:
1{2"notifications": [3{4"id": "comms_notification_01h2xcejqtf2nbrexx3vqjhp41",5"to": [6{7"token": "FCM_DEVICE_TOKEN",8"provider": "FCM"9}10],11"status": "SENT",12"related": [13{14"name": "operation",15"id": "comms_operation_01h2xcejqtf2nbrexx3vqjhp41",16"uri": "/PushNotifications/Operations/01h2xcejqtf2nbrexx3vqjhp41"17}18],19"tags": {},20"createdAt": "2023-08-24T14:15:22Z",21"updatedAt": "2023-08-24T14:15:22Z",22"deletedAt": null23}24],25"pagination": {26"next": null,27"self": "https://comms.twilio.com/v1/PushNotifications"28}29}
For more details, see the List PushNotifications API reference.
See the Personalization guide to learn how to personalize push notifications for each recipient.