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:

Resource properties
sidtype: SID<BS>Not PII

A 34 character string that uniquely identifies this resource.


chat_service_sidtype: SID<IS>Not PII

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


date_createdtype: string<DATE TIME>Not PII

The date that this resource was created.


date_updatedtype: string<DATE TIME>Not PII

The date that this resource was last updated.


endpointtype: stringPII MTL: 30 days

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


binding_typetype: enum<STRING>Not PII

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

message_typestype: string[]Not PII

urltype: string<URI>Not PII

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}

Parameters

fetch-parameters page anchor
URI parameters
ChatServiceSidtype: SID<IS>Not PII
Path Parameter

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


Sidtype: SID<BS>Not PII
Path Parameter

A 34 character string that uniquely identifies this resource.

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

Output

_17
{
_17
"sid": "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"chat_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_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": "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"message_types": [
_17
"removed_from_conversation",
_17
"new_message",
_17
"added_to_conversation"
_17
],
_17
"url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings/BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
}


Read multiple ServiceBinding resources

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

URI parameters
ChatServiceSidtype: SID<IS>Not PII
Path Parameter

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


BindingTypetype: string[]Not PII
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:
apngcmfcm

Identitytype: string[]PII MTL: 30 days
Query Parameter

PageSizetype: integerNot PII
Query Parameter

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


Pagetype: integerNot PII
Query Parameter

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


PageTokentype: stringNot PII
Query Parameter

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

_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.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.bindings
_11
.list({limit: 20})
_11
.then(bindings => bindings.forEach(b => console.log(b.sid)));

Output

_30
{
_30
"meta": {
_30
"page": 0,
_30
"page_size": 50,
_30
"first_page_url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings?PageSize=50&Page=0",
_30
"previous_page_url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings?PageSize=50&Page=0",
_30
"url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings?PageSize=50&Page=0",
_30
"next_page_url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings?PageSize=50&Page=1",
_30
"key": "bindings"
_30
},
_30
"bindings": [
_30
{
_30
"sid": "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"chat_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_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": "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"message_types": [
_30
"removed_from_conversation",
_30
"new_message",
_30
"added_to_conversation"
_30
],
_30
"url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings/BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_30
}
_30
]
_30
}


Delete a ServiceBinding resource

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

URI parameters
ChatServiceSidtype: SID<IS>Not PII
Path Parameter

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


Sidtype: SID<BS>Not PII
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.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.bindings('BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.remove();


Rate this page: