Skip to contentSkip to navigationSkip to topbar
Rate this Page:

Conversation Service Resource


A Conversation Service is the top-level container for other resources in the Twilio Conversations REST API. All other Twilio Conversations resources, such as Conversations, Users, Messages, Bindings, and Credentials belong to a specific Service.

Services allow you to:

  • Create multiple, distinct environments (such as dev, stage, and prod ) under a single Twilio account
  • Scope access to resources through both the REST and client APIs
  • Configure different Service instances with specific behaviors

A Service can also send HTTPS requests (webhooks) to URLs that you define to let you know of specific events. See what events you can subscribe to in our webhook reference(link takes you to an external page).

(error)

Danger

Do not use Personally Identifiable Information (PII) for the friendlyName field.

Avoid using a person's name, home address, email, phone number, or other PII in the friendlyName field. Use some form of pseudonymized identifier, instead.

You can learn more about how we process your data in our privacy policy.(link takes you to an external page)


Service Defaults in the Twilio Console

service-defaults-in-the-twilio-console page anchor

You can use the REST API to configure your Conversation Service instances. (See the following examples.)

You can also find the default Conversation Service instance under Defaults in the Conversations Section(link takes you to an external page) of the Twilio Console.

You may have created non-default Conversation Service resources to separate messaging traffic, create development environments, etc. To access any non-default Conversation Service resources, the Service Sid (ISXXX) has to be a part of the url, as shown below:


_10
https://conversations.twilio.com/v1/Services/ISXXX
_10
_10
https://conversations.twilio.com/v1/Services/ISXXX/Conversations
_10
_10
https://conversations.twilio.com/v1/Services/ISXXX/Conversations/CHXXX/Participants
_10
_10
https://conversations.twilio.com/v1/Services/ISXXX/Conversations/CHXXX/Messages


The Service resource contains these properties:

Resource properties
account_sidtype: SID<AC>

The unique ID of the Account(link takes you to an external page) responsible for this service.


sidtype: SID<IS>

A 34 character string that uniquely identifies this resource.


friendly_nametype: string
PII MTL: 30 days

The human-readable name of this service, limited to 256 characters. Optional.


date_createdtype: string<DATE TIME>

The date that this resource was created.


date_updatedtype: string<DATE TIME>

The date that this resource was last updated.


urltype: string<URI>

An absolute API resource URL for this service.


linkstype: object<URI MAP>

Contains absolute API resource URLs to access conversations, users, roles, bindings and configuration of this service.


Create a Service resource

create-a-service-resource page anchor
POST https://conversations.twilio.com/v1/Services

Parameters

create-parameters page anchor
Request body parameters
FriendlyNametype: stringRequired

The human-readable name of this service, limited to 256 characters. Optional.

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
_10
.create({friendlyName: 'friendly_name'})
_10
.then(service => console.log(service.sid));

Output

_16
{
_16
"sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"friendly_name": "friendly_name",
_16
"date_created": "2015-12-16T22:18:37Z",
_16
"date_updated": "2015-12-16T22:18:38Z",
_16
"url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"links": {
_16
"conversations": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations",
_16
"users": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users",
_16
"roles": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Roles",
_16
"bindings": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings",
_16
"configuration": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Configuration",
_16
"participant_conversations": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ParticipantConversations"
_16
}
_16
}


Fetch a Service resource

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

URI parameters
Sidtype: SID<IS>
Path Parameter

A 34 character string that uniquely identifies this resource.

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
.fetch()
_10
.then(service => console.log(service.friendlyName));

Output

_16
{
_16
"sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"friendly_name": "My First Service",
_16
"date_created": "2015-12-16T22:18:37Z",
_16
"date_updated": "2015-12-16T22:18:38Z",
_16
"url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"links": {
_16
"conversations": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations",
_16
"users": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users",
_16
"roles": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Roles",
_16
"bindings": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings",
_16
"configuration": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Configuration",
_16
"participant_conversations": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ParticipantConversations"
_16
}
_16
}


Read multiple Service resources

read-multiple-service-resources page anchor
GET https://conversations.twilio.com/v1/Services

URI parameters
PageSizetype: integer
Query Parameter

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


Pagetype: integer
Query Parameter

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


PageTokentype: string
Query Parameter

The page token. This is provided by the API.

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
_10
.list({limit: 20})
_10
.then(services => services.forEach(s => console.log(s.sid)));

Output

_29
{
_29
"services": [
_29
{
_29
"sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"friendly_name": "Home Service",
_29
"date_created": "2015-12-16T22:18:37Z",
_29
"date_updated": "2015-12-16T22:18:38Z",
_29
"url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_29
"links": {
_29
"conversations": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations",
_29
"users": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Users",
_29
"roles": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Roles",
_29
"bindings": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Bindings",
_29
"configuration": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Configuration",
_29
"participant_conversations": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ParticipantConversations"
_29
}
_29
}
_29
],
_29
"meta": {
_29
"page": 0,
_29
"page_size": 50,
_29
"first_page_url": "https://conversations.twilio.com/v1/Services?PageSize=50&Page=0",
_29
"previous_page_url": "https://conversations.twilio.com/v1/Services?PageSize=50&Page=0",
_29
"url": "https://conversations.twilio.com/v1/Services?PageSize=50&Page=0",
_29
"next_page_url": "https://conversations.twilio.com/v1/Services?PageSize=50&Page=1",
_29
"key": "services"
_29
}
_29
}


Delete a Service resource

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

URI parameters
Sidtype: SID<IS>
Path Parameter

A 34 character string that uniquely identifies this resource.

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
.remove();


Rate this Page: