Skip to contentSkip to navigationSkip to topbar
Rate this Page:

Programmable Chat 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.

A Binding resource of Programmable Chat represents a push notification subscription for a User within their Service instance. Bindings are unique per service instance, user identity, device, and notification channel (such as APNS, GCM, FCM).

We recommend following the standard URI specification and avoid the following reserved characters ! * ' ( ) ; : @ & = + $ , / ? % # [ ] for values such as identity and friendly name.


Binding Properties

binding-properties page anchor

Each Binding resource contains these properties.

Resource properties
sidtype: SID<BS>

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


account_sidtype: SID<AC>

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


service_sidtype: SID<IS>

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


date_createdtype: string<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_updatedtype: string<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.


endpointtype: string
PII MTL: 30 days

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


identitytype: string

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.


credential_sidtype: SID<CR>

binding_typetype: enum<STRING>

The push technology to use for the 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[]

urltype: string<URI>

The absolute URL of the Binding resource.


linkstype: object<URI MAP>

The absolute URLs of the Binding's User(link takes you to an external page).


Fetch a Binding resource

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

Parameters

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

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


Sidtype: SID<BS>
Path Parameter

The SID of the Binding resource to fetch.

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
.bindings('BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.fetch()
_11
.then(binding => console.log(binding.sid));

Output

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


Read multiple Binding resources

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

URI parameters
ServiceSidtype: SID<IS>
Path Parameter

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


BindingTypetype: string[]
Query Parameter

The push technology used by the 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

Identitytype: string[]
Query ParameterPII MTL: 30 days

The User(link takes you to an external page)'s identity value of the resources to read. See access tokens(link takes you to an external page) for more details.


PageSizetype: integer
Query Parameter

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


Pagetype: integer
Query Parameter

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


PageTokentype: string
Query Parameter

The page token. This is provided by the API.

Read multiple Binding resources

read-multiple-binding-resources-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
.bindings
_11
.list({limit: 20})
_11
.then(bindings => bindings.forEach(b => console.log(b.sid)));

Output

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


Delete a Binding resource

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

URI parameters
ServiceSidtype: SID<IS>
Path Parameter

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


Sidtype: SID<BS>
Path Parameter

The SID of the Binding resource to delete.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

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


Rate this Page: