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.

sidSID<BS>
Not PII

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

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

account_sidSID<AC>

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

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

service_sidSID<IS>

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

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

date_createdstring<date-time>

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


date_updatedstring<date-time>

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


endpointstring
PII MTL: 30 days

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


identitystring

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_sidSID<US>

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

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

credential_sidSID<CR>

The SID of the Credential(link takes you to an external page) for the binding. See push notification configuration(link takes you to an external page) for more info.

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

binding_typeenum<string>

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_typesarray[string]

urlstring<uri>

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.

Path parameters

path-parameters page anchor
ServiceSidSID<IS>required

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

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

UserSidstringrequired

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.


SidSID<BS>required

The SID of the User Binding resource to fetch.

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

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.

ServiceSidSID<IS>required

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

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

UserSidstringrequired

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.

BindingTypearray[enum<string>]

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

PageSizeinteger

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

Minimum: 1

Pageinteger

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

Minimum: 0

PageTokenstring

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.

ServiceSidSID<IS>required

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

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

UserSidstringrequired

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.


SidSID<BS>required

The SID of the User Binding resource to delete.

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

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: