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.
All URLs in the reference documentation use the following base URL:
_10https://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:
_10GET /v1/Services/ISxx/Conversations/CHxx/Messages
Property nameTypePIIDescription
The unique ID of the Account responsible for this conversation.
Pattern: ^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique ID of the Conversation Service this conversation belongs to.
Pattern: ^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
messaging_service_sidSID<MG> The unique ID of the Messaging Service this conversation belongs to.
Pattern: ^MG[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
A 34 character string that uniquely identifies this resource.
Pattern: ^CH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The human-readable name of this conversation, limited to 256 characters. Optional.
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.
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.
Current state of this conversation. Can be either active
, inactive
or closed
and defaults to active
Possible values: inactive
active
closed
date_createdstring<date-time> The date that this resource was created.
date_updatedstring<date-time> The date that this resource was last updated.
Timer date values representing state update for this conversation.
An absolute API resource URL for this conversation.
POST https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations
Property nameTypeRequiredPIIDescription
ChatServiceSidSID<IS>required The SID of the Conversation Service the Conversation resource is associated with.
Pattern: ^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional The human-readable name of this conversation, limited to 256 characters. Optional.
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.
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.
MessagingServiceSidSID<MG>Optional The unique ID of the Messaging Service this conversation belongs to.
Pattern: ^MG[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
DateCreatedstring<date-time>Optional The date that this resource was created.
DateUpdatedstring<date-time>Optional The date that this resource was last updated.
Stateenum<string>Optional Current state of this conversation. Can be either active
, inactive
or closed
and defaults to active
Possible values: inactive
active
closed
Timers.InactivestringOptional ISO8601 duration when conversation will be switched to inactive
state. Minimum value for this timer is 1 minute.
Timers.ClosedstringOptional ISO8601 duration when conversation will be switched to closed
state. Minimum value for this timer is 10 minutes.
Bindings.Email.AddressstringOptional The default email address that will be used when sending outbound emails in this conversation.
Bindings.Email.NamestringOptional The default name that will be used when sending outbound emails in this conversation.
_18// Download the helper library from https://www.twilio.com/docs/node/install
_18const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18// Find your Account SID and Auth Token at twilio.com/console
_18// and set the environment variables. See http://twil.io/secure
_18const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18const authToken = process.env.TWILIO_AUTH_TOKEN;
_18const client = twilio(accountSid, authToken);
_18async function createServiceConversation() {
_18 const conversation = await client.conversations.v1
_18 .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18 .conversations.create();
_18 console.log(conversation.accountSid);
_18createServiceConversation();
_23 "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "friendly_name": "friendly_name",
_23 "unique_name": "unique_name",
_23 "attributes": "{ \"topic\": \"feedback\" }",
_23 "date_created": "2015-12-16T22:18:37Z",
_23 "date_updated": "2015-12-16T22:18:38Z",
_23 "date_inactive": "2015-12-16T22:19:38Z",
_23 "date_closed": "2015-12-16T22:28:38Z"
_23 "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "participants": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
_23 "messages": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages",
_23 "webhooks": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks"
GET https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{Sid}
Property nameTypeRequiredPIIDescription
ChatServiceSidSID<IS>required The SID of the Conversation Service the Conversation resource is associated with.
Pattern: ^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
A 34 character string that uniquely identifies this resource. Can also be the unique_name
of the Conversation.
_19// Download the helper library from https://www.twilio.com/docs/node/install
_19const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19// Find your Account SID and Auth Token at twilio.com/console
_19// and set the environment variables. See http://twil.io/secure
_19const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19const authToken = process.env.TWILIO_AUTH_TOKEN;
_19const client = twilio(accountSid, authToken);
_19async function fetchServiceConversation() {
_19 const conversation = await client.conversations.v1
_19 .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19 .conversations("Sid")
_19 console.log(conversation.accountSid);
_19fetchServiceConversation();
_23 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "friendly_name": "My First Conversation",
_23 "unique_name": "first_conversation",
_23 "attributes": "{ \"topic\": \"feedback\" }",
_23 "date_created": "2015-12-16T22:18:37Z",
_23 "date_updated": "2015-12-16T22:18:38Z",
_23 "date_inactive": "2015-12-16T22:19:38Z",
_23 "date_closed": "2015-12-16T22:28:38Z"
_23 "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "participants": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
_23 "messages": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages",
_23 "webhooks": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks"
GET https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations
Property nameTypeRequiredPIIDescription
ChatServiceSidSID<IS>required The SID of the Conversation Service the Conversation resource is associated with.
Pattern: ^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Property nameTypeRequiredPIIDescription
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.
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.
Stateenum<string>Optional State for sorting and filtering list of Conversations. Can be active
, inactive
or closed
Possible values: inactive
active
closed
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Minimum: 1
Maximum: 1000
The page index. This value is simply for client state.
Minimum: 0
The page token. This is provided by the API.
_18// Download the helper library from https://www.twilio.com/docs/node/install
_18const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18// Find your Account SID and Auth Token at twilio.com/console
_18// and set the environment variables. See http://twil.io/secure
_18const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18const authToken = process.env.TWILIO_AUTH_TOKEN;
_18const client = twilio(accountSid, authToken);
_18async function listServiceConversation() {
_18 const conversations = await client.conversations.v1
_18 .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18 .conversations.list({ limit: 20 });
_18 conversations.forEach((c) => console.log(c.accountSid));
_18listServiceConversation();
_36 "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_36 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_36 "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_36 "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_36 "friendly_name": "Home Repair Visit",
_36 "attributes": "{ \"topic\": \"feedback\" }",
_36 "date_created": "2015-12-16T22:18:37Z",
_36 "date_updated": "2015-12-16T22:18:38Z",
_36 "date_inactive": "2015-12-16T22:19:38Z",
_36 "date_closed": "2015-12-16T22:28:38Z"
_36 "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_36 "participants": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
_36 "messages": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages",
_36 "webhooks": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks"
_36 "first_page_url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations?PageSize=50&Page=0",
_36 "previous_page_url": null,
_36 "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations?PageSize=50&Page=0",
_36 "next_page_url": null,
_36 "key": "conversations"
POST https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{Sid}
Property nameTypeRequiredPIIDescription
ChatServiceSidSID<IS>required The SID of the Conversation Service the Conversation resource is associated with.
Pattern: ^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
A 34 character string that uniquely identifies this resource. Can also be the unique_name
of the Conversation.
Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional The human-readable name of this conversation, limited to 256 characters. Optional.
DateCreatedstring<date-time>Optional The date that this resource was created.
DateUpdatedstring<date-time>Optional The date that this resource was last updated.
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.
MessagingServiceSidSID<MG>Optional The unique ID of the Messaging Service this conversation belongs to.
Pattern: ^MG[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Stateenum<string>Optional Current state of this conversation. Can be either active
, inactive
or closed
and defaults to active
Possible values: inactive
active
closed
Timers.InactivestringOptional ISO8601 duration when conversation will be switched to inactive
state. Minimum value for this timer is 1 minute.
Timers.ClosedstringOptional ISO8601 duration when conversation will be switched to closed
state. Minimum value for this timer is 10 minutes.
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.AddressstringOptional The default email address that will be used when sending outbound emails in this conversation.
Bindings.Email.NamestringOptional The default name that will be used when sending outbound emails in this conversation.
_19// Download the helper library from https://www.twilio.com/docs/node/install
_19const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19// Find your Account SID and Auth Token at twilio.com/console
_19// and set the environment variables. See http://twil.io/secure
_19const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19const authToken = process.env.TWILIO_AUTH_TOKEN;
_19const client = twilio(accountSid, authToken);
_19async function updateServiceConversation() {
_19 const conversation = await client.conversations.v1
_19 .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19 .conversations("Sid")
_19 .update({ friendlyName: "FriendlyName" });
_19 console.log(conversation.accountSid);
_19updateServiceConversation();
_23 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
_23 "friendly_name": "FriendlyName",
_23 "unique_name": "unique_name",
_23 "attributes": "{ \"topic\": \"feedback\" }",
_23 "date_created": "2015-12-16T22:18:37Z",
_23 "date_updated": "2015-12-16T22:18:38Z",
_23 "date_inactive": "2015-12-16T22:19:38Z",
_23 "date_closed": "2015-12-16T22:28:38Z"
_23 "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_23 "participants": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
_23 "messages": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages",
_23 "webhooks": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks"
DELETE https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{Sid}
Property nameTypeRequiredPIIDescription
ChatServiceSidSID<IS>required The SID of the Conversation Service the Conversation resource is associated with.
Pattern: ^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
A 34 character string that uniquely identifies this resource. Can also be the unique_name
of the Conversation.
_17// Download the helper library from https://www.twilio.com/docs/node/install
_17const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_17// Find your Account SID and Auth Token at twilio.com/console
_17// and set the environment variables. See http://twil.io/secure
_17const accountSid = process.env.TWILIO_ACCOUNT_SID;
_17const authToken = process.env.TWILIO_AUTH_TOKEN;
_17const client = twilio(accountSid, authToken);
_17async function deleteServiceConversation() {
_17 await client.conversations.v1
_17 .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_17 .conversations("Sid")
_17deleteServiceConversation();