Skip to contentSkip to navigationSkip to topbar
Rate this page:
On 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.

Property nameTypePIIDescription
sidSID<BS>
Not PII

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

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

account_sidSID<AC>

The SID of the Account that created the Binding resource.

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

service_sidSID<IS>

The SID of the Service the 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 Binding. The format of this value depends on the binding_type.


identitystring

The application-defined string that uniquely identifies the resource's User within the Service. See access tokens for more info.


credential_sidSID<CR>

The SID of the Credential for the binding. See push notification configuration 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 Binding. Can be: apn, gcm, or fcm. See push notification configuration for more info.

Possible values:
gcmapnfcm

message_typesarray[string]

The Programmable Chat message types the binding is subscribed to.


urlstring<uri>

The absolute URL of the Binding resource.


linksobject<uri-map>

The absolute URLs of the Binding's User.


Fetch a Binding resource

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

Path parameters

path-parameters page anchor
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: 34Max length: 34

SidSID<BS>required

The SID of the Binding resource to fetch.

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

Fetch a Binding resource

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

_15
// Download the helper library from https://www.twilio.com/docs/node/install
_15
import twilio from "twilio";
_15
_15
// Find your Account SID and Auth Token at twilio.com/console
_15
// and set the environment variables. See http://twil.io/secure
_15
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_15
const authToken = process.env.TWILIO_AUTH_TOKEN;
_15
const client = twilio(accountSid, authToken);
_15
_15
const binding = await client.chat.v2
_15
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_15
.bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_15
.fetch();
_15
_15
console.log(binding.sid);

Output

_21
{
_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
"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/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_21
"links": {
_21
"user": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users/TestUser"
_21
}
_21
}


Read multiple Binding resources

read-multiple-binding-resources page anchor
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: 34Max 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:
gcmapnfcm

Identityarray[string]Optional

The User's identity value of the resources to read. See access tokens for more details.


PageSizeintegerOptional

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

Minimum: 1Maximum: 1000

PageintegerOptional

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

Minimum: 0

PageTokenstringOptional

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

_14
// Download the helper library from https://www.twilio.com/docs/node/install
_14
import twilio from "twilio";
_14
_14
// Find your Account SID and Auth Token at twilio.com/console
_14
// and set the environment variables. See http://twil.io/secure
_14
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14
const authToken = process.env.TWILIO_AUTH_TOKEN;
_14
const client = twilio(accountSid, authToken);
_14
_14
const bindings = await client.chat.v2
_14
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_14
.bindings.list({ limit: 20 });
_14
_14
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/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
"key": "bindings"
_34
},
_34
"bindings": [
_34
{
_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
"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/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_34
"links": {
_34
"user": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/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}

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: 34Max length: 34

SidSID<BS>required

The SID of the Binding resource to delete.

Pattern: ^BS[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

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


Rate this page: