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

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:

Property nameTypePIIDescription
account_sidSID<AC>
Not PII

The unique ID of the Account responsible for this service.

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

sidSID<IS>

A 34 character string that uniquely identifies this resource.

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

friendly_namestring
PII MTL: 30 days

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


date_createdstring<date-time>

The date that this resource was created.


date_updatedstring<date-time>

The date that this resource was last updated.


urlstring<uri>

An absolute API resource URL for this service.


linksobject<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

Request body parameters

request-body-parameters page anchor
Property nameTypeRequiredPIIDescription
FriendlyNamestringrequired

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

Create a Service

create-a-service 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 service = await client.conversations.v1.services.create({
_14
friendlyName: "FriendlyName",
_14
});
_14
_14
console.log(service.accountSid);

Output

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


Fetch a Service resource

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

Property nameTypeRequiredPIIDescription
SidSID<IS>required

A 34 character string that uniquely identifies this resource.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34
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 service = await client.conversations.v1
_14
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_14
.fetch();
_14
_14
console.log(service.accountSid);

Output

_16
{
_16
"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_16
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_16
"links": {
_16
"conversations": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations",
_16
"users": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users",
_16
"roles": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",
_16
"bindings": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",
_16
"configuration": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration",
_16
"participant_conversations": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ParticipantConversations"
_16
}
_16
}


Read multiple Service resources

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

Property nameTypeRequiredPIIDescription
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.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

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

Output

_29
{
_29
"services": [
_29
{
_29
"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_29
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_29
"links": {
_29
"conversations": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations",
_29
"users": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users",
_29
"roles": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",
_29
"bindings": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings",
_29
"configuration": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration",
_29
"participant_conversations": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/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": null,
_29
"url": "https://conversations.twilio.com/v1/Services?PageSize=50&Page=0",
_29
"next_page_url": null,
_29
"key": "services"
_29
}
_29
}


Delete a Service resource

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

Property nameTypeRequiredPIIDescription
SidSID<IS>required

A 34 character string that uniquely identifies this resource.

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

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


Rate this page: