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.
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.
Each Binding resource contains these properties.
The unique string that we created to identify the Binding resource.
^BS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Account that created the Binding resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Service the Binding resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The date and time in GMT when the resource was created specified in ISO 8601 format.
The date and time in GMT when the resource was last updated specified in ISO 8601 format.
The unique endpoint identifier for the Binding. The format of this value depends on the binding_type
.
The application-defined string that uniquely identifies the resource's User within the Service. See access tokens for more info.
The SID of the Credential for the binding. See push notification configuration for more info.
^CR[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The push technology to use for the Binding. Can be: apn
, gcm
, or fcm
. See push notification configuration for more info.
gcm
apn
fcm
The Programmable Chat message types the binding is subscribed to.
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Bindings/{Sid}
The SID of the Service to fetch the Binding resource from.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Binding resource to fetch.
^BS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchBinding() {11const binding = await client.chat.v212.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.fetch();1516console.log(binding.sid);17}1819fetchBinding();
1{2"sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"date_created": "2016-10-21T11:37:03Z",6"date_updated": "2016-10-21T11:37:03Z",7"endpoint": "TestUser-endpoint",8"identity": "TestUser",9"binding_type": "gcm",10"credential_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",11"message_types": [12"removed_from_channel",13"new_message",14"added_to_channel",15"invited_to_channel"16],17"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"links": {19"user": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/TestUser"20}21}
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Bindings
The push technology used by the Binding resources to read. Can be: apn
, gcm
, or fcm
. See push notification configuration for more info.
gcm
apn
fcm
The User's identity
value of the resources to read. See access tokens for more details.
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listBinding() {11const bindings = await client.chat.v212.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.bindings.list({ limit: 20 });1415bindings.forEach((b) => console.log(b.sid));16}1718listBinding();
1{2"meta": {3"page": 0,4"page_size": 50,5"first_page_url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=50&Page=0",6"previous_page_url": null,7"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=50&Page=0",8"next_page_url": null,9"key": "bindings"10},11"bindings": [12{13"sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"date_created": "2016-10-21T11:37:03Z",17"date_updated": "2016-10-21T11:37:03Z",18"endpoint": "TestUser-endpoint",19"identity": "TestUser",20"binding_type": "gcm",21"credential_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",22"message_types": [23"removed_from_channel",24"new_message",25"added_to_channel",26"invited_to_channel"27],28"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",29"links": {30"user": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/TestUser"31}32}33]34}
DELETE https://chat.twilio.com/v2/Services/{ServiceSid}/Bindings/{Sid}
The SID of the Service to delete the Binding resource from.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Binding resource to delete.
^BS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function deleteBinding() {11await client.chat.v212.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.remove();15}1617deleteBinding();