The Push Notifications API is currently available as a
Private Beta product. The information contained in this document is subject to change. You acknowledge
and agree that your use of the Twilio Push Notifications API is subject to the terms of the Services in
Private Beta. This
means that some features are not yet implemented and others may be changed before the product is
declared as Generally Available. Private Beta products are not covered by the Twilio Support Terms or
Twilio Service Level Agreement.
A PushNotification resource represents a push notification sent through the Twilio Communications API. You can send notifications to Android devices, Apple devices, and web browsers through a single API.
You can send personalized notifications to up to 10,000 recipients in a single request, with a mix of APNs and FCM recipients.
When you send a notification, the API returns an operationId that you can use to track delivery status. See Operation resource for details.
(information)
Info
Records are available for 7 days after creation. Requests for data older than 7 days may return incomplete results.
The priority of the Push Notification. A value of "low" reduces the client app battery consumption. A value of "high" sends the notification immediately and can wake up a sleeping device.
The date and time when the Push Notification was last updated, in ISO 8601 format.
PushNotification status values
Status
Description
SCHEDULED
The notification is scheduled for future delivery.
QUEUED
The notification is queued for sending.
SENT
The notification was sent to the provider.
FAILED
The notification failed during processing.
CANCELED
The notification was canceled via the API.
Send a PushNotification
POST https://comms.twilio.com/v1/PushNotifications
Send a push notification to one or more recipients by making an HTTP POST request to the Notifications resource URI.
The to array accepts up to 10,000 recipients. Each recipient can be either a direct recipient (with a device token and provider) or a User recipient (with a userId). You can include both APN and FCM recipients in the same request.
You can personalize notification content for each recipient using LiquidJS templates. Pass recipient-specific variables in the variables object for each recipient.
Recipient types
You can address recipients in two ways:
Direct recipient: Provide a device token and provider (APN or FCM).
User recipient: Provide a userId referencing a User. The API delivers to all devices registered to that User.
From object
Use the optional from object to specify which credentials or app to use for sending. You can either:
Provide specific credential IDs with fcm and apn fields.
Provide an appName to use that app's default credentials.
If omitted, the API uses the default App and its associated credentials.
Schedule object
Use the optional schedule object to schedule notifications for future delivery. Provide an array of RFC 3339 datetime strings in the sendAt field. Notifications can be scheduled up to 7 days in the future.
Tags object
Attach custom key-value metadata to notifications using the optional tags object. Tags support up to 10 pairs, with keys up to 128 characters and values up to 256 characters. Tags support Liquid templating.
To personalize content for each recipient, supply variables here with values to substitute into any Liquid templated content string or pre-stored Content template.
The priority of the Push Notification. A value of "low" reduces the client app battery consumption. A value of "high" sends the notification immediately and can wake up a sleeping device.
The maximum time you can schedule a communication is 7 days in the future.
Currently, you may specify only a single expression.
If you specify multiple expressions, only the first will be used.
Support for additional scheduling expression formats may be added in the future.
Custom metadata in the form of key-value pairs.
Maximum size of a tag key is 128 characters.
Maximum size of a tag value is 256 characters.
There can be a maximum of 10 key-value pairs.
This field can be templated with Liquid.
Specify variables with each recipient for personalization.
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.
Identifies a single device for delivering push notifications via the specified provider.
providerenum<string>
Optional
Push notification service provider.
Possible values:
APNFCM
priorityenum<string>
Optional
The priority of the Push Notification. A value of "low" reduces the client app battery consumption. A value of "high" sends the notification immediately and can wake up a sleeping device.
Default: HIGHPossible values:
HIGHLOW
soundstring or null
Optional
The name of the sound to be played for the push notification.
statusenum<string>
Optional
The status of a Push Notification resource. The status can be one of the following:
scheduled The Push Notification is scheduled to be sent by
Twilio in the future.
queued The Push Notification is queued in Twilio for sending.
sent The Push Notification resource has been sent by Twilio.
failed The Push Notification resource processing failed inside Twilio.
Use GET /PushNotifications/Operations/{operationId}/Errors for more details.
canceled The communication resource was canceled via API request.
Possible values:
SCHEDULEDQUEUEDSENTFAILEDCANCELED
createdAtstring<date-time>
Optional
The date and time when the Push Notification was created, in ISO 8601 format.
updatedAtstring<date-time>
Optional
The date and time when the Push Notification was last updated, in ISO 8601 format.
Match Push Notifications by one or many tags.
If more than one tag is specified in the query,
the search will return only results that have ALL the matching tags.
For Example:
GET /PushNotifications?tags=ageGroup:20s;industry:engineering;
Identifies a single device for delivering push notifications via the specified provider.
providerenum<string>
Optional
Push notification service provider.
Possible values:
APNFCM
priorityenum<string>
Optional
The priority of the Push Notification. A value of "low" reduces the client app battery consumption. A value of "high" sends the notification immediately and can wake up a sleeping device.
Default: HIGHPossible values:
HIGHLOW
soundstring or null
Optional
The name of the sound to be played for the push notification.
statusenum<string>
Optional
The status of a Push Notification resource. The status can be one of the following:
scheduled The Push Notification is scheduled to be sent by
Twilio in the future.
queued The Push Notification is queued in Twilio for sending.
sent The Push Notification resource has been sent by Twilio.
failed The Push Notification resource processing failed inside Twilio.
Use GET /PushNotifications/Operations/{operationId}/Errors for more details.
canceled The communication resource was canceled via API request.
Possible values:
SCHEDULEDQUEUEDSENTFAILEDCANCELED
createdAtstring<date-time>
Optional
The date and time when the Push Notification was created, in ISO 8601 format.
updatedAtstring<date-time>
Optional
The date and time when the Push Notification was last updated, in ISO 8601 format.
paginationPaginationMetadata
Optional
Metadata for paginated results.
This object contains two tokens to navigate through paginated results.
Use next to retrieve the 'next' page in the result list.
Use self to retrieve the same page of the result list again.