Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Service Binding Resource


A Binding resource in Twilio Conversations 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).


ServiceBinding Properties

servicebinding-properties page anchor

Each Binding resource has the following properties:

Property nameTypePIIDescription
sidSID<BS>
Not PII

A 34 character string that uniquely identifies this resource.

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

account_sidSID<AC>

The unique ID of the Account responsible for this binding.

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

chat_service_sidSID<IS>

The SID of the Conversation Service the Binding resource is associated with.

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

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

date_createdstring<date-time>

The date that this resource was created.


date_updatedstring<date-time>

The date that this resource was last updated.


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 Conversation User within the Conversation Service. See access tokens for more info.


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:
apngcmfcm

message_typesarray[string]

The Conversation message types the binding is subscribed to.


urlstring<uri>

An absolute API resource URL for this binding.


Fetch a ServiceBinding resource

fetch-a-servicebinding-resource page anchor
GET https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Bindings/{Sid}

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
ChatServiceSidSID<IS>required

The SID of the Conversation Service the Binding resource is associated with.

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

SidSID<BS>required

A 34 character string that uniquely identifies this resource.

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

Fetch a ServiceBinding

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

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function fetchServiceBinding() {
_19
const binding = await client.conversations.v1
_19
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.fetch();
_19
_19
console.log(binding.sid);
_19
}
_19
_19
fetchServiceBinding();

Output

_17
{
_17
"sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_17
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_17
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_17
"date_created": "2016-10-21T11:37:03Z",
_17
"date_updated": "2016-10-21T11:37:03Z",
_17
"endpoint": "TestUser-endpoint",
_17
"identity": "TestUser",
_17
"binding_type": "gcm",
_17
"credential_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_17
"message_types": [
_17
"removed_from_conversation",
_17
"new_message",
_17
"added_to_conversation"
_17
],
_17
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_17
}


Read multiple ServiceBinding resources

read-multiple-servicebinding-resources page anchor
GET https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Bindings

Property nameTypeRequiredPIIDescription
ChatServiceSidSID<IS>required

The SID of the Conversation Service the Binding resource is associated with.

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:
apngcmfcm

Identityarray[string]Optional

The identity of a Conversation User this binding belongs to. 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.

List multiple ServiceBindings

list-multiple-servicebindings page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function listServiceBinding() {
_18
const bindings = await client.conversations.v1
_18
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.bindings.list({ limit: 20 });
_18
_18
bindings.forEach((b) => console.log(b.sid));
_18
}
_18
_18
listServiceBinding();

Output

_30
{
_30
"meta": {
_30
"page": 0,
_30
"page_size": 50,
_30
"first_page_url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=50&Page=0",
_30
"previous_page_url": null,
_30
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=50&Page=0",
_30
"next_page_url": null,
_30
"key": "bindings"
_30
},
_30
"bindings": [
_30
{
_30
"sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_30
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_30
"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_30
"date_created": "2016-10-21T11:37:03Z",
_30
"date_updated": "2016-10-21T11:37:03Z",
_30
"endpoint": "TestUser-endpoint",
_30
"identity": "TestUser",
_30
"binding_type": "gcm",
_30
"credential_sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_30
"message_types": [
_30
"removed_from_conversation",
_30
"new_message",
_30
"added_to_conversation"
_30
],
_30
"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_30
}
_30
]
_30
}


Delete a ServiceBinding resource

delete-a-servicebinding-resource page anchor
DELETE https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Bindings/{Sid}

Property nameTypeRequiredPIIDescription
ChatServiceSidSID<IS>required

The SID of the Conversation 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

_17
// Download the helper library from https://www.twilio.com/docs/node/install
_17
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_17
_17
// Find your Account SID and Auth Token at twilio.com/console
_17
// and set the environment variables. See http://twil.io/secure
_17
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_17
const authToken = process.env.TWILIO_AUTH_TOKEN;
_17
const client = twilio(accountSid, authToken);
_17
_17
async function deleteServiceBinding() {
_17
await client.conversations.v1
_17
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_17
.bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_17
.remove();
_17
}
_17
_17
deleteServiceBinding();


Rate this page: