Conversation Participant Resource
Each Participant in a Conversation represents one real (probably human) participant in a Conversation.
Creating a Participant joins them with the conversation, and the connected person will receive all subsequent messages.
Deleting a participant removes them from the conversation. They will receive no new messages after that point, but their previous messages will remain in the conversation.
All URLs in the reference documentation use the following base URL:
_10https://conversations.twilio.com/v1
Using the REST API, you can interact with Conversation Participant resources in the default Conversation Service instance via a "shortened" URL that does not include the Conversation Service instance SID ("ISXXX..."). If you are only using one Conversation Service (the default), you do not need to include the Conversation Service SID in your URL, e.g.
_10GET /v1/Conversations/CHxx/Participants
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/Participants
Property nameTypePIIDescription
The unique ID of the Account responsible for this participant.
Pattern: ^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique ID of the Conversation for this participant.
Pattern: ^CH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
A 34 character string that uniquely identifies this resource.
Pattern: ^MB[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
A unique string identifier for the conversation participant as Conversation User. This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters.
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.
Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant.
The SID of a conversation-level Role to assign to the participant.
Pattern: ^RL[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
date_createdstring<date-time> The date that this resource was created.
date_updatedstring<date-time> The date that this resource was last updated.
An absolute API resource URL for this participant.
last_read_message_indexinteger Index of last “read” message in the Conversation for the Participant.
last_read_timestampstring Timestamp of last “read” message in the Conversation for the Participant.
POST https://conversations.twilio.com/v1/Conversations/{ConversationSid}/Participants
Adding a new participant to an ongoing conversation immediately allows them to see all subsequent communications. The same person (i.e., a single personal phone number) can be part of any number of conversations concurrently, as long as the address they are in contact with (the ProxyAddress
) is unique.
To create a Conversation Participant by SMS, you must enter:
-
Their phone number as the
messagingbinding.address
-
Your Twilio number as the
messagingbinding.proxyaddress
.
To create a Conversation Participant by Chat, you must enter the Chat User Identity as the identity
parameter.
We recommend following the standard URI specification and avoid the following reserved characters ! * ' ( ) ; : @ & = + $ , / ? % # [ ]
for values such as identity and friendly name.
Property nameTypeRequiredPIIDescription
ConversationSidstringrequired
Property nameTypeRequiredPIIDescription
A unique string identifier for the conversation participant as Conversation User. This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters.
MessagingBinding.AddressstringOptional The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with proxy_address) is only null when the participant is interacting from an SDK endpoint (see the 'identity' field).
MessagingBinding.ProxyAddressstringOptional The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the 'identity' field).
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.
MessagingBinding.ProjectedAddressstringOptional The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity.
The SID of a conversation-level Role to assign to the participant.
Pattern: ^RL[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Connect someone to a Conversation over SMS
_21// Download the helper library from https://www.twilio.com/docs/node/install
_21const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_21// Find your Account SID and Auth Token at twilio.com/console
_21// and set the environment variables. See http://twil.io/secure
_21const accountSid = process.env.TWILIO_ACCOUNT_SID;
_21const authToken = process.env.TWILIO_AUTH_TOKEN;
_21const client = twilio(accountSid, authToken);
_21async function createConversationParticipant() {
_21 const participant = await client.conversations.v1
_21 .conversations("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_21 .participants.create({
_21 "messagingBinding.address": "+15558675310",
_21 "messagingBinding.proxyAddress": "<Your Twilio Number>",
_21 console.log(participant.sid);
_21createConversationParticipant();
_18 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "conversation_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18 "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "attributes": "{ \"role\": \"driver\" }",
_18 "messaging_binding": {
_18 "address": "+15558675310",
_18 "proxy_address": "+15017122661"
_18 "role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "date_created": "2015-12-16T22:18:37Z",
_18 "date_updated": "2015-12-16T22:18:38Z",
_18 "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "last_read_message_index": null,
_18 "last_read_timestamp": null
Connect someone to a Conversation over Chat
_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 createConversationParticipant() {
_18 const participant = await client.conversations.v1
_18 .conversations("ConversationSid")
_18 .participants.create({ identity: "<Chat User Identity>" });
_18 console.log(participant.sid);
_18createConversationParticipant();
_14 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14 "conversation_sid": "ConversationSid",
_14 "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14 "identity": "<Chat User Identity>",
_14 "attributes": "{ \"role\": \"driver\" }",
_14 "messaging_binding": null,
_14 "role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14 "date_created": "2015-12-16T22:18:37Z",
_14 "date_updated": "2015-12-16T22:18:38Z",
_14 "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14 "last_read_message_index": null,
_14 "last_read_timestamp": null
GET https://conversations.twilio.com/v1/Conversations/{ConversationSid}/Participants/{Sid}
Property nameTypeRequiredPIIDescription
ConversationSidstringrequired
A 34 character string that uniquely identifies this resource. Alternatively, you can pass a Participant's identity
rather than the SID.
Fetch a Conversation Participant by SID
_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 fetchConversationParticipant() {
_19 const participant = await client.conversations.v1
_19 .conversations("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_19 .participants("MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_19 console.log(participant.accountSid);
_19fetchConversationParticipant();
_18 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "conversation_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18 "sid": "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18 "attributes": "{ \"role\": \"driver\" }",
_18 "messaging_binding": {
_18 "address": "+15558675310",
_18 "proxy_address": "+15017122661"
_18 "role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "date_created": "2016-03-24T21:05:50Z",
_18 "date_updated": "2016-03-24T21:05:50Z",
_18 "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "last_read_message_index": null,
_18 "last_read_timestamp": null
You can also fetch a Conversation Participant by their identity
. Pass their identity
as the value for the sid
argument.
Fetch a Conversation Participant by identity
_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 fetchConversationParticipant() {
_19 const participant = await client.conversations.v1
_19 .conversations("ConversationSid")
_19 .participants("alice")
_19 console.log(participant.accountSid);
_19fetchConversationParticipant();
_18 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "conversation_sid": "ConversationSid",
_18 "attributes": "{ \"role\": \"driver\" }",
_18 "messaging_binding": {
_18 "address": "+15558675310",
_18 "proxy_address": "+15017122661"
_18 "role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "date_created": "2016-03-24T21:05:50Z",
_18 "date_updated": "2016-03-24T21:05:50Z",
_18 "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "last_read_message_index": null,
_18 "last_read_timestamp": null
GET https://conversations.twilio.com/v1/Conversations/{ConversationSid}/Participants
Property nameTypeRequiredPIIDescription
ConversationSidstringrequired
Property nameTypeRequiredPIIDescription
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 listConversationParticipant() {
_18 const participants = await client.conversations.v1
_18 .conversations("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_18 .participants.list({ limit: 20 });
_18 participants.forEach((p) => console.log(p.accountSid));
_18listConversationParticipant();
_45 "first_page_url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0",
_45 "previous_page_url": null,
_45 "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0",
_45 "next_page_url": null,
_45 "key": "participants"
_45 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_45 "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_45 "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_45 "attributes": "{ \"role\": \"driver\" }",
_45 "messaging_binding": {
_45 "address": "+15558675310",
_45 "proxy_address": "+15017122661"
_45 "role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_45 "date_created": "2016-03-24T21:05:50Z",
_45 "date_updated": "2016-03-24T21:05:50Z",
_45 "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_45 "last_read_message_index": null,
_45 "last_read_timestamp": null
_45 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_45 "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_45 "sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_45 "identity": "IDENTITY",
_45 "attributes": "{ \"role\": \"driver\" }",
_45 "messaging_binding": null,
_45 "role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_45 "date_created": "2016-03-24T21:05:50Z",
_45 "date_updated": "2016-03-24T21:05:50Z",
_45 "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_45 "last_read_message_index": null,
_45 "last_read_timestamp": null
POST https://conversations.twilio.com/v1/Conversations/{ConversationSid}/Participants/{Sid}
Property nameTypeRequiredPIIDescription
ConversationSidstringrequired
A 34 character string that uniquely identifies this resource.
Property nameTypeRequiredPIIDescription
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.
The SID of a conversation-level Role to assign to the participant.
Pattern: ^RL[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
MessagingBinding.ProxyAddressstringOptional The address of the Twilio phone number that the participant is in contact with. 'null' value will remove it.
MessagingBinding.ProjectedAddressstringOptional The address of the Twilio phone number that is used in Group MMS. 'null' value will remove it.
A unique string identifier for the conversation participant as Conversation User. This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters.
LastReadMessageIndexintegerOptional Index of last “read” message in the Conversation for the Participant.
LastReadTimestampstringOptional Timestamp of last “read” message in the Conversation for the Participant.
Update Conversation Participant by SID
_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 updateConversationParticipant() {
_19 const participant = await client.conversations.v1
_19 .conversations("ConversationSid")
_19 .update({ dateUpdated: new Date("2019-05-15 13:37:35") });
_19 console.log(participant.accountSid);
_19updateConversationParticipant();
_18 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "conversation_sid": "ConversationSid",
_18 "attributes": "{ \"role\": \"driver\" }",
_18 "messaging_binding": {
_18 "address": "+15558675310",
_18 "proxy_address": "+15017122661"
_18 "role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "date_created": "2015-12-16T22:18:37Z",
_18 "date_updated": "2019-05-15T13:37:35Z",
_18 "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "last_read_message_index": null,
_18 "last_read_timestamp": null
_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 updateConversationParticipant() {
_19 const participant = await client.conversations.v1
_19 .conversations("ConversationSid")
_19 .update({ attributes: JSON.stringify({ role: "driver" }) });
_19 console.log(participant.accountSid);
_19updateConversationParticipant();
_18 "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "conversation_sid": "ConversationSid",
_18 "attributes": "{\"role\": \"driver\"}",
_18 "messaging_binding": {
_18 "address": "+15558675310",
_18 "proxy_address": "+15017122661"
_18 "role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "date_created": "2015-12-16T22:18:37Z",
_18 "date_updated": "2015-12-16T22:18:38Z",
_18 "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18 "last_read_message_index": null,
_18 "last_read_timestamp": null
DELETE https://conversations.twilio.com/v1/Conversations/{ConversationSid}/Participants/{Sid}
Property nameTypeRequiredPIIDescription
ConversationSidstringrequired
A 34 character string that uniquely identifies this resource.
Delete a Conversation Participant by SID
_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 deleteConversationParticipant() {
_17 await client.conversations.v1
_17 .conversations("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_17 .participants("MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_17deleteConversationParticipant();