Skip to contentSkip to navigationSkip to topbar
On this page

Notifications Resource



Description

description page anchor

This resource is meant to be used when implementing Verify Push. It lets developers request that Verify Push retry sending a push notification for the same Challenge. Previously, there was a 1:1 mapping between a Challenge and push notification, so developers had to create a new, duplicate Challenge to resend a push notification for the same verification action (e.g. two-factor auth for a user login). They then had to deduplicate the Challenges on the client side. This implementation complexity is removed with this resource.

(warning)

Warning

The Notifications resource is currently in the Pilot maturity stage, please check with Twilio before using it in production.

(information)

Info

APNs/FCM behavior: Please be aware that APNs and FCM already have built-in queuing and retry logic for the scenario where the device was offline when the push notification was requested. When the device becomes online again, all non-expired push notifications (based on the push's time-to-live / ttl) will be sent again. We recommend that developers limit the number of retries a user can request, so that the user doesn't accidentally "over-request" and end up getting a flood of push notifications. We have also made ttl a configurable resource parameter, so developers can expire past push notifications more quickly if this becomes a problem.

Challenge expiration: Please note that the Challenge itself can still expire. Requesting a retry push notification on an expired Challenge will result in an error response, and developers will need to create a new Challenge. This won't create a deduplication problem for the client-side though, because the client can just request pending, not expired, Challenges.


Property nameTypeRequiredDescriptionChild properties
sidSID<NT>Optional
Not PII

A 34 character string that uniquely identifies this Notification.

Pattern: ^NT[0-9a-fA-F]{32}$Min length: 34Max length: 34

account_sidSID<AC>Optional

The unique SID identifier of the Account.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

service_sidSID<VA>Optional

The unique SID identifier of the Service.

Pattern: ^VA[0-9a-fA-F]{32}$Min length: 34Max length: 34

entity_sidSID<YE>Optional

The unique SID identifier of the Entity.

Pattern: ^YE[0-9a-fA-F]{32}$Min length: 34Max length: 34

identitystringOptional
PII MTL: 30 days

Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters.


challenge_sidSID<YC>Optional

The unique SID identifier of the Challenge.

Pattern: ^YC[0-9a-fA-F]{32}$Min length: 34Max length: 34

prioritystringOptional

The priority of the notification. For push Challenges it's always high which sends the notification immediately, and can wake up a sleeping device.


ttlintegerOptional

How long, in seconds, the notification is valid. Max: 5 minutes

Default: 0


Resend Push Notification

resend-push-notification page anchor
POST https://verify.twilio.com/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges/{ChallengeSid}/Notifications

(warning)

Warning

Only 3 Push Notifications can be created per Challenge

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
ServiceSidSID<VA>required

The unique SID identifier of the Service.

Pattern: ^VA[0-9a-fA-F]{32}$Min length: 34Max length: 34

Identitystringrequired

Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters.


ChallengeSidSID<YC>required

The unique SID identifier of the Challenge.

Pattern: ^YC[0-9a-fA-F]{32}$Min length: 34Max length: 34
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
TtlintegerOptional

How long, in seconds, the notification is valid. Can be an integer between 0 and 300. Default is 300. Delivery is attempted until the TTL elapses, even if the device is offline. 0 means that the notification delivery is attempted immediately, only once, and is not stored for future delivery.

Create a NotificationLink to code sample: Create a Notification
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createNotification() {
11
const notification = await client.verify.v2
12
.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.entities("Identity")
14
.challenges("YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
15
.notifications.create();
16
17
console.log(notification.sid);
18
}
19
20
createNotification();

Output

1
{
2
"sid": "NTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"entity_sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
6
"identity": "Identity",
7
"challenge_sid": "YCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
8
"date_created": "2015-07-30T20:00:00Z",
9
"priority": "high",
10
"ttl": 150
11
}

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.