Programmable Chat Binding Resource
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.
Property nameTypeRequiredDescriptionChild properties
The unique string that we created to identify the Binding resource.
Pattern: ^BS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
account_sidSID<AC>Optional The SID of the Account that created the Binding resource.
Pattern: ^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
service_sidSID<IS>Optional The SID of the Service the Binding resource is associated with.
Pattern: ^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
date_createdstring<date-time>Optional
date_updatedstring<date-time>Optional
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.
credential_sidSID<CR>Optional
binding_typeenum<string>Optional
message_typesarray[string]Optional
The absolute URL of the Binding resource.
linksobject<uri-map>Optional The absolute URLs of the Binding's User.
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Bindings/{Sid}
Property nameTypeRequiredPIIDescription
ServiceSidSID<IS>required The SID of the Service to fetch the Binding resource from.
Pattern: ^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Binding resource to fetch.
Pattern: ^BS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
_19// Download the helper library from https://www.twilio.com/docs/node/install
_19const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19// Find your Account SID and Auth Token at twilio.com/console
_19// and set the environment variables. See http://twil.io/secure
_19const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19const authToken = process.env.TWILIO_AUTH_TOKEN;
_19const client = twilio(accountSid, authToken);
_19async function fetchBinding() {
_19 const binding = await client.chat.v2
_19 .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19 .bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19 console.log(binding.sid);
_21 "sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_21 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_21 "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_21 "removed_from_channel",
_21 "url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_21 "user": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/TestUser"
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Bindings
Property nameTypeRequiredPIIDescription
ServiceSidSID<IS>required The SID of the Service to read the Binding resources from.
Pattern: ^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Property nameTypeRequiredPIIDescription
BindingTypearray[enum<string>]Optional The push technology used by the Binding resources to read. Can be: apn
, gcm
, or fcm
. See push notification configuration for more info.
Possible values: gcm
apn
fcm
Identityarray[string]Optional 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.
Minimum: 1
Maximum: 1000
The page index. This value is simply for client state.
Minimum: 0
The page token. This is provided by the API.
_18// Download the helper library from https://www.twilio.com/docs/node/install
_18const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18// Find your Account SID and Auth Token at twilio.com/console
_18// and set the environment variables. See http://twil.io/secure
_18const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18const authToken = process.env.TWILIO_AUTH_TOKEN;
_18const client = twilio(accountSid, authToken);
_18async function listBinding() {
_18 const bindings = await client.chat.v2
_18 .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18 .bindings.list({ limit: 20 });
_18 bindings.forEach((b) => console.log(b.sid));
_34 "first_page_url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=50&Page=0",
_34 "previous_page_url": null,
_34 "url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=50&Page=0",
_34 "next_page_url": null,
_34 "sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_34 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_34 "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_34 "removed_from_channel",
_34 "url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_34 "user": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/TestUser"
DELETE https://chat.twilio.com/v2/Services/{ServiceSid}/Bindings/{Sid}
Property nameTypeRequiredPIIDescription
ServiceSidSID<IS>required The SID of the Service to delete the Binding resource from.
Pattern: ^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Binding resource to delete.
Pattern: ^BS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
_17// Download the helper library from https://www.twilio.com/docs/node/install
_17const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_17// Find your Account SID and Auth Token at twilio.com/console
_17// and set the environment variables. See http://twil.io/secure
_17const accountSid = process.env.TWILIO_ACCOUNT_SID;
_17const authToken = process.env.TWILIO_AUTH_TOKEN;
_17const client = twilio(accountSid, authToken);
_17async function deleteBinding() {
_17 .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_17 .bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")