Users resource
Beta
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 User stores an end user's device tokens as DeviceRegistrations in the Push Notifications API. The API creates a new User automatically when you register a device and omit the userId.
You can send notifications to a User by providing their userId in the to array when sending a notification. The API delivers the notification to all devices registered to that User.
A reference to a Push Notification User.
comms_pushnotificationuser_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_pushnotificationuser_[0-7][a-hjkmnpqrstv-z0-9]{25,34}The date and time the User was deleted, if applicable.
GET https://comms.twilio.com/v1/PushNotifications/Users/{userId}
Retrieve a single User resource by making an HTTP GET request to the User resource URI with the User ID.
comms_pushnotificationuser_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_pushnotificationuser_[0-7][a-hjkmnpqrstv-z0-9]{25,34}OK
Optional
A reference to a Push Notification User.
comms_pushnotificationuser_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_pushnotificationuser_[0-7][a-hjkmnpqrstv-z0-9]{25,34}Optional
The date and time the User was created.
Optional
The date and time the User was last updated.
Optional
The date and time the User was deleted, if applicable.
1import { TwilioClient } from "twilio-comms";23async function main() {4const client = new TwilioClient({5accountId: "<username>",6authToken: "<password>",7});8await client.pushNotifications.users.fetch("comms_pushnotificationuser_01h9krwprkeee8fzqspvwy6nq8");9}10main();
GET https://comms.twilio.com/v1/PushNotifications/Users
Returns a list of all push notification Users associated with your account.
OK
Optional
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: "<username>",6authToken: "<password>",7});8await client.pushNotifications.users.list({9pageToken: "pageToken",10pageSize: 50,11});12}13main();
DELETE https://comms.twilio.com/v1/PushNotifications/Users/{userId}
Delete a User by making an HTTP DELETE request to the User resource URI with the User ID.
If successful, returns HTTP 202 (Accepted) with a resource ID to check the result.
comms_pushnotificationuser_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_pushnotificationuser_[0-7][a-hjkmnpqrstv-z0-9]{25,34}The request was accepted and a resource ID is available to check the result. The response body contains the resource ID and link to the resource.
Optional
The Resource ID is an identifier for the resource that was created or updated in response to the request.
Optional
The location (uri) of the resource identified by Resource-Id.
1import { TwilioClient } from "twilio-comms";23async function main() {4const client = new TwilioClient({5accountId: "<username>",6authToken: "<password>",7});8await client.pushNotifications.users.delete("comms_pushnotificationuser_01h9krwprkeee8fzqspvwy6nq8");9}10main();