Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

User Binding Resource


(error)

Danger

Programmable Chat has been deprecated and is no longer supported. Instead, we'll be focusing on the next generation of chat: Twilio Conversations. Find out more about the EOL process here(link takes you to an external page).

If you're starting a new project, please visit the Conversations Docs to begin. If you've already built on Programmable Chat, please visit our Migration Guide to learn about how to switch.

The User Binding resource provides access to Binding resources that is scoped to a single User.


UserBinding Properties

userbinding-properties page anchor

Each User Binding resource contains these properties.

Resource properties
sidtype: SID<BS>Not PII

The unique string that we created to identify the User Binding resource.


account_sidtype: SID<AC>Not PII

The SID of the Account(link takes you to an external page) that created the User Binding resource.


service_sidtype: SID<IS>Not PII

The SID of the Service(link takes you to an external page) the User Binding resource is associated with.


date_createdtype: string<DATE TIME>Not PII

The date and time in GMT when the resource was created specified in ISO 8601(link takes you to an external page) format.


date_updatedtype: string<DATE TIME>Not PII

The date and time in GMT when the resource was last updated specified in ISO 8601(link takes you to an external page) format.


endpointtype: stringPII MTL: 30 days

The unique endpoint identifier for the User Binding. The format of the value depends on the binding_type.


identitytype: stringPII MTL: 30 days

The application-defined string that uniquely identifies the resource's User(link takes you to an external page) within the Service(link takes you to an external page). See access tokens(link takes you to an external page) for more info.


user_sidtype: SID<US>Not PII

binding_typetype: enum<STRING>Not PII

The push technology to use for the User Binding. Can be: apn, gcm, or fcm. See push notification configuration(link takes you to an external page) for more info.

Possible values:
gcmapnfcm

message_typestype: string[]Not PII

urltype: string<URI>Not PII

The absolute URL of the User Binding resource.


Fetch a User Binding resource

fetch-a-user-binding-resource page anchor
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings/{Sid}

The {UserSid} value can be either the sid or the identity of the User resource to fetch the User Binding resource from.

Parameters

fetch-parameters page anchor
URI parameters
ServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Service(link takes you to an external page) to fetch the User Binding resource from.


UserSidtype: stringNot PII
Path Parameter

The SID of the User(link takes you to an external page) with the User Binding resource to fetch. See push notification configuration(link takes you to an external page) for more info.


Sidtype: SID<BS>Not PII
Path Parameter

The SID of the User Binding resource to fetch.

Fetch a User Binding resource

fetch-a-user-binding-resource-1 page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.userBindings('BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.fetch()
_12
.then(user_binding => console.log(user_binding.sid));

Output

_19
{
_19
"sid": "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"date_created": "2016-10-21T11:37:03Z",
_19
"date_updated": "2016-10-21T11:37:03Z",
_19
"endpoint": "TestUser-endpoint",
_19
"identity": "TestUser",
_19
"user_sid": "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"binding_type": "gcm",
_19
"credential_sid": "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_19
"message_types": [
_19
"removed_from_channel",
_19
"new_message",
_19
"added_to_channel",
_19
"invited_to_channel"
_19
],
_19
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings/BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_19
}


Read multiple UserBinding resources

read-multiple-userbinding-resources page anchor
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings

The {UserSid} value can be either the sid or the identity of the User resource to read User Binding resources from.

URI parameters
ServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Service(link takes you to an external page) to read the User Binding resources from.


UserSidtype: stringNot PII
Path Parameter

The SID of the User(link takes you to an external page) with the User Binding resources to read. See push notification configuration(link takes you to an external page) for more info.


BindingTypetype: string[]Not PII
Query Parameter

The push technology used by the User Binding resources to read. Can be: apn, gcm, or fcm. See push notification configuration(link takes you to an external page) for more info.

Possible values:
gcmapnfcm

PageSizetype: integerNot PII
Query Parameter

How many resources to return in each list page. The default is 50, and the maximum is 1000.


Pagetype: integerNot PII
Query Parameter

The page index. This value is simply for client state.


PageTokentype: stringNot PII
Query Parameter

The page token. This is provided by the API.

Read multiple User Binding resources

read-multiple-user-binding-resources page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.userBindings
_12
.list({limit: 20})
_12
.then(userBindings => userBindings.forEach(u => console.log(u.sid)));

Output

_32
{
_32
"meta": {
_32
"page": 0,
_32
"page_size": 50,
_32
"first_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings?PageSize=50&Page=0",
_32
"previous_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings?PageSize=50&Page=0",
_32
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings?PageSize=50&Page=0",
_32
"next_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings?PageSize=50&Page=1",
_32
"key": "bindings"
_32
},
_32
"bindings": [
_32
{
_32
"sid": "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_32
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_32
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_32
"date_created": "2016-10-21T11:37:03Z",
_32
"date_updated": "2016-10-21T11:37:03Z",
_32
"endpoint": "TestUser-endpoint",
_32
"identity": "TestUser",
_32
"user_sid": "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_32
"binding_type": "gcm",
_32
"credential_sid": "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_32
"message_types": [
_32
"removed_from_channel",
_32
"new_message",
_32
"added_to_channel",
_32
"invited_to_channel"
_32
],
_32
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users/USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings/BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_32
}
_32
]
_32
}


Delete a User Binding resource

delete-a-user-binding-resource page anchor
DELETE https://chat.twilio.com/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings/{Sid}

The {UserSid} value can be either the sid or the identity of the User resource to delete the User Channel resource from.

URI parameters
ServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Service(link takes you to an external page) to delete the User Binding resource from.


UserSidtype: stringNot PII
Path Parameter

The SID of the User(link takes you to an external page) with the User Binding resources to delete. See push notification configuration(link takes you to an external page) for more info.


Sidtype: SID<BS>Not PII
Path Parameter

The SID of the User Binding resource to delete.

Delete a User Binding resource

delete-a-user-binding-resource-1 page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.userBindings('BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.remove();


Rate this page: