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

Service-Scoped Conversation Resource


A Service-scoped Conversation is a unique thread of a conversation that is scoped or limited to a specific, non-default Conversation Service.

Please see the Conversation Resource for Conversations within the default Conversation Service instance.


API Base URL

api-base-url page anchor

All URLs in the reference documentation use the following base URL:


_10
https://conversations.twilio.com/v1

For Conversations applications that build on more than one Conversation Service instance, you will need to specify the Conversation Service SID in the REST API call:


_10
GET /v1/Services/ISxx/Conversations/CHxx/Messages


Service-Scoped Conversation Properties

service-scoped-conversation-properties page anchor
Resource properties
account_sidtype: SID<AC>
Not PII

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

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

chat_service_sidtype: SID<IS>

The unique ID of the Conversation Service(link takes you to an external page) this conversation belongs to.

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

messaging_service_sidtype: SID<MG>

The unique ID of the Messaging Service(link takes you to an external page) this conversation belongs to.

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

sidtype: SID<CH>

A 34 character string that uniquely identifies this resource.

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

friendly_nametype: string

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


unique_nametype: string

An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's sid in the URL.


attributestype: string

An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set "{}" will be returned.


statetype: enum<string>

Current state of this conversation. Can be either active, inactive or closed and defaults to active

Possible values:
inactiveactiveclosed

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.


timerstype: object

Timer date values representing state update for this conversation.


urltype: string<uri>

An absolute API resource URL for this conversation.


bindingstype: null

Create a Service-Scoped Conversation

create-a-service-scoped-conversation page anchor
POST https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations

Parameters

create-parameters page anchor
Request headers
X-Twilio-Webhook-Enabledtype: enum<string>

The X-Twilio-Webhook-Enabled HTTP request header

Possible values:
truefalse

URI parameters
ChatServiceSidtype: SID<IS>
Path ParameterNot PII

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

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

Request body parameters
FriendlyNametype: string

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


UniqueNametype: string

An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's sid in the URL.


Attributestype: string

An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set "{}" will be returned.


MessagingServiceSidtype: SID<MG>

The unique ID of the Messaging Service(link takes you to an external page) this conversation belongs to.

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

DateCreatedtype: string<date-time>

The date that this resource was created.


DateUpdatedtype: string<date-time>

The date that this resource was last updated.


Statetype: enum<string>

Current state of this conversation. Can be either active, inactive or closed and defaults to active

Possible values:
inactiveactiveclosed

Timers.Inactivetype: string

ISO8601 duration when conversation will be switched to inactive state. Minimum value for this timer is 1 minute.


Timers.Closedtype: string

ISO8601 duration when conversation will be switched to closed state. Minimum value for this timer is 10 minutes.


Bindings.Email.Addresstype: string

The default email address that will be used when sending outbound emails in this conversation.


Bindings.Email.Nametype: string

The default name that will be used when sending outbound emails in this conversation.

Create a ServiceConversation

create-a-serviceconversation 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
.conversations
_11
.create()
_11
.then(conversation => console.log(conversation.sid));

Output

_25
{
_25
"sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"chat_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"messaging_service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"friendly_name": "friendly_name",
_25
"unique_name": "unique_name",
_25
"attributes": {
_25
"topic": "feedback"
_25
},
_25
"date_created": "2015-12-16T22:18:37Z",
_25
"date_updated": "2015-12-16T22:18:38Z",
_25
"state": "inactive",
_25
"timers": {
_25
"date_inactive": "2015-12-16T22:19:38Z",
_25
"date_closed": "2015-12-16T22:28:38Z"
_25
},
_25
"bindings": {},
_25
"url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"links": {
_25
"participants": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants",
_25
"messages": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages",
_25
"webhooks": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks"
_25
}
_25
}


Fetch a Service-Scoped Conversation

fetch-a-service-scoped-conversation page anchor
GET https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{Sid}

URI parameters
ChatServiceSidtype: SID<IS>
Path ParameterNot PII

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

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

Sidtype: string
Path ParameterNot PII

A 34 character string that uniquely identifies this resource. Can also be the unique_name of the Conversation.

Fetch a ServiceConversation

fetch-a-serviceconversation 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
.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.fetch()
_11
.then(conversation => console.log(conversation.friendlyName));

Output

_25
{
_25
"sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"chat_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"messaging_service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"friendly_name": "My First Conversation",
_25
"unique_name": "first_conversation",
_25
"attributes": {
_25
"topic": "feedback"
_25
},
_25
"date_created": "2015-12-16T22:18:37Z",
_25
"date_updated": "2015-12-16T22:18:38Z",
_25
"state": "active",
_25
"timers": {
_25
"date_inactive": "2015-12-16T22:19:38Z",
_25
"date_closed": "2015-12-16T22:28:38Z"
_25
},
_25
"bindings": {},
_25
"url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"links": {
_25
"participants": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants",
_25
"messages": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages",
_25
"webhooks": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks"
_25
}
_25
}


Read multiple Service-Scoped Conversation resources

read-multiple-service-scoped-conversation-resources page anchor
GET https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations

URI parameters
ChatServiceSidtype: SID<IS>
Path ParameterNot PII

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

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

StartDatetype: string
Query ParameterNot PII

Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order.


EndDatetype: string
Query ParameterNot PII

Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order.


Statetype: enum<string>
Query ParameterNot PII

State for sorting and filtering list of Conversations. Can be active, inactive or closed

Possible values:
inactiveactiveclosed

PageSizetype: integer
Query ParameterNot PII

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

Minimum:
1

Pagetype: integer
Query ParameterNot PII

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

Minimum:
0

PageTokentype: string
Query ParameterNot PII

The page token. This is provided by the API.

List multiple ServiceConversations

list-multiple-serviceconversations 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
.conversations
_11
.list({limit: 20})
_11
.then(conversations => conversations.forEach(c => console.log(c.sid)));

Output

_38
{
_38
"conversations": [
_38
{
_38
"sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_38
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_38
"chat_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_38
"messaging_service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_38
"friendly_name": "Home Repair Visit",
_38
"unique_name": null,
_38
"attributes": {
_38
"topic": "feedback"
_38
},
_38
"date_created": "2015-12-16T22:18:37Z",
_38
"date_updated": "2015-12-16T22:18:38Z",
_38
"state": "active",
_38
"timers": {
_38
"date_inactive": "2015-12-16T22:19:38Z",
_38
"date_closed": "2015-12-16T22:28:38Z"
_38
},
_38
"bindings": {},
_38
"url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_38
"links": {
_38
"participants": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants",
_38
"messages": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages",
_38
"webhooks": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks"
_38
}
_38
}
_38
],
_38
"meta": {
_38
"page": 0,
_38
"page_size": 50,
_38
"first_page_url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations?PageSize=50&Page=0",
_38
"previous_page_url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations?PageSize=50&Page=0",
_38
"url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations?PageSize=50&Page=0",
_38
"next_page_url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations?PageSize=50&Page=1",
_38
"key": "conversations"
_38
}
_38
}


Update a Service-Scoped Conversation resource

update-a-service-scoped-conversation-resource page anchor
POST https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{Sid}

Request headers
X-Twilio-Webhook-Enabledtype: enum<string>

The X-Twilio-Webhook-Enabled HTTP request header

Possible values:
truefalse

URI parameters
ChatServiceSidtype: SID<IS>
Path ParameterNot PII

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

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

Sidtype: string
Path ParameterNot PII

A 34 character string that uniquely identifies this resource. Can also be the unique_name of the Conversation.


Request body parameters
FriendlyNametype: string

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


DateCreatedtype: string<date-time>

The date that this resource was created.


DateUpdatedtype: string<date-time>

The date that this resource was last updated.


Attributestype: string

An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set "{}" will be returned.


MessagingServiceSidtype: SID<MG>

The unique ID of the Messaging Service(link takes you to an external page) this conversation belongs to.

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

Statetype: enum<string>

Current state of this conversation. Can be either active, inactive or closed and defaults to active

Possible values:
inactiveactiveclosed

Timers.Inactivetype: string

ISO8601 duration when conversation will be switched to inactive state. Minimum value for this timer is 1 minute.


Timers.Closedtype: string

ISO8601 duration when conversation will be switched to closed state. Minimum value for this timer is 10 minutes.


UniqueNametype: string

An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's sid in the URL.


Bindings.Email.Addresstype: string

The default email address that will be used when sending outbound emails in this conversation.


Bindings.Email.Nametype: string

The default name that will be used when sending outbound emails in this conversation.

Update a ServiceConversation

update-a-serviceconversation 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
.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.update({friendlyName: 'friendly_name'})
_11
.then(conversation => console.log(conversation.friendlyName));

Output

_25
{
_25
"sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"chat_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"messaging_service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"friendly_name": "friendly_name",
_25
"unique_name": "unique_name",
_25
"attributes": {
_25
"topic": "feedback"
_25
},
_25
"date_created": "2015-12-16T22:18:37Z",
_25
"date_updated": "2015-12-16T22:18:38Z",
_25
"state": "inactive",
_25
"timers": {
_25
"date_inactive": "2015-12-16T22:19:38Z",
_25
"date_closed": "2015-12-16T22:28:38Z"
_25
},
_25
"bindings": {},
_25
"url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"links": {
_25
"participants": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants",
_25
"messages": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages",
_25
"webhooks": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Webhooks"
_25
}
_25
}


Delete a Service-Scoped Conversation

delete-a-service-scoped-conversation page anchor
DELETE https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{Sid}

Request headers
X-Twilio-Webhook-Enabledtype: enum<string>

The X-Twilio-Webhook-Enabled HTTP request header

Possible values:
truefalse

URI parameters
ChatServiceSidtype: SID<IS>
Path ParameterNot PII

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

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

Sidtype: string
Path ParameterNot PII

A 34 character string that uniquely identifies this resource. Can also be the unique_name of the Conversation.

Delete a ServiceConversation

delete-a-serviceconversation page anchor
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
.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.remove();


Rate this page: