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

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.


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

Using the shortened base URL

using-the-shortened-base-url page anchor

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.


_10
GET /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:


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


ConversationParticipant Properties

conversationparticipant-properties page anchor
Property nameTypePIIDescription
account_sidSID<AC>
Not PII

The unique ID of the Account responsible for this participant.

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

conversation_sidSID<CH>

The unique ID of the Conversation for this participant.

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

sidSID<MB>

A 34 character string that uniquely identifies this resource.

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

identitystring
PII MTL: 30 days

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.


attributesstring

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.


messaging_bindingobject

Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant.


role_sidSID<RL>

The SID of a conversation-level Role to assign to the participant.

Pattern: ^RL[0-9a-fA-F]{32}$Min length: 34Max 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.


urlstring<uri>

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.


Add a Conversation Participant (SMS)

add-a-conversation-participant-sms page anchor
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:

  1. Their phone number as the messagingbinding.address
  2. 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
X-Twilio-Webhook-Enabledenum<string>Optional

The X-Twilio-Webhook-Enabled HTTP request header

Possible values:
truefalse
Property nameTypeRequiredPIIDescription
ConversationSidstringrequired

The unique ID of the Conversation for this participant.

Property nameTypeRequiredPIIDescription
IdentitystringOptional

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.


AttributesstringOptional

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.


RoleSidSID<RL>Optional

The SID of a conversation-level Role to assign to the participant.

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

Create Conversation Participant (SMS)

create-conversation-participant-sms page anchor

Connect someone to a Conversation over SMS

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

_17
// Download the helper library from https://www.twilio.com/docs/node/install
_17
import twilio from "twilio";
_17
_17
// Find your Account SID and Auth Token at twilio.com/console
_17
// and set the environment variables. See http://twil.io/secure
_17
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_17
const authToken = process.env.TWILIO_AUTH_TOKEN;
_17
const client = twilio(accountSid, authToken);
_17
_17
const participant = await client.conversations.v1
_17
.conversations("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_17
.participants.create({
_17
messagingBindingAddress: "+15558675310",
_17
messagingBindingProxyAddress: "<Your Twilio Number>",
_17
});
_17
_17
console.log(participant.sid);

Output

_18
{
_18
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18
"conversation_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18
"identity": null,
_18
"attributes": "{ \"role\": \"driver\" }",
_18
"messaging_binding": {
_18
"type": "sms",
_18
"address": "+15558675310",
_18
"proxy_address": "+15017122661"
_18
},
_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
_18
}

Create Conversation Participant (Chat)

create-conversation-participant-chat page anchor

Connect someone to a Conversation over Chat

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 participant = await client.conversations.v1
_14
.conversations("ConversationSid")
_14
.participants.create({ identity: "<Chat User Identity>" });
_14
_14
console.log(participant.sid);

Output

_14
{
_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
_14
}


Fetch a ConversationParticipant resource

fetch-a-conversationparticipant-resource page anchor
GET https://conversations.twilio.com/v1/Conversations/{ConversationSid}/Participants/{Sid}

Property nameTypeRequiredPIIDescription
ConversationSidstringrequired

The unique ID of the Conversation for this participant.


Sidstringrequired

A 34 character string that uniquely identifies this resource. Alternatively, you can pass a Participant's identity rather than the SID.

Fetch Conversation Participant by SID

fetch-conversation-participant-by-sid page anchor

Fetch a Conversation Participant by SID

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

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

Output

_18
{
_18
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18
"conversation_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"sid": "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"identity": null,
_18
"attributes": "{ \"role\": \"driver\" }",
_18
"messaging_binding": {
_18
"type": "sms",
_18
"address": "+15558675310",
_18
"proxy_address": "+15017122661"
_18
},
_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
_18
}

You can also fetch a Conversation Participant by their identity. Pass their identity as the value for the sid argument.

Fetch Conversation Participant by identity

fetch-conversation-participant-by-identity page anchor

Fetch a Conversation Participant by identity

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

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

Output

_18
{
_18
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18
"conversation_sid": "ConversationSid",
_18
"sid": "alice",
_18
"identity": "alice",
_18
"attributes": "{ \"role\": \"driver\" }",
_18
"messaging_binding": {
_18
"type": "sms",
_18
"address": "+15558675310",
_18
"proxy_address": "+15017122661"
_18
},
_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
_18
}


Read multiple ConversationParticipant resources

read-multiple-conversationparticipant-resources page anchor
GET https://conversations.twilio.com/v1/Conversations/{ConversationSid}/Participants

Property nameTypeRequiredPIIDescription
ConversationSidstringrequired

The unique ID of the Conversation for participants.

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.

List Conversation Participant(s)

list-conversation-participants 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 participants = await client.conversations.v1
_14
.conversations("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_14
.participants.list({ limit: 20 });
_14
_14
participants.forEach((p) => console.log(p.accountSid));

Output

_45
{
_45
"meta": {
_45
"page": 0,
_45
"page_size": 50,
_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
},
_45
"participants": [
_45
{
_45
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_45
"conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_45
"sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_45
"identity": null,
_45
"attributes": "{ \"role\": \"driver\" }",
_45
"messaging_binding": {
_45
"type": "sms",
_45
"address": "+15558675310",
_45
"proxy_address": "+15017122661"
_45
},
_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
},
_45
{
_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
_45
}
_45
]
_45
}


Update a ConversationParticipant resource

update-a-conversationparticipant-resource page anchor
POST https://conversations.twilio.com/v1/Conversations/{ConversationSid}/Participants/{Sid}

Property nameTypeRequiredPIIDescription
X-Twilio-Webhook-Enabledenum<string>Optional

The X-Twilio-Webhook-Enabled HTTP request header

Possible values:
truefalse
Property nameTypeRequiredPIIDescription
ConversationSidstringrequired

The unique ID of the Conversation for this participant.


Sidstringrequired

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.


AttributesstringOptional

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.


RoleSidSID<RL>Optional

The SID of a conversation-level Role to assign to the participant.

Pattern: ^RL[0-9a-fA-F]{32}$Min length: 34Max 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.


IdentitystringOptional

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

update-conversation-participant page anchor

Update Conversation Participant by SID

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

_15
// Download the helper library from https://www.twilio.com/docs/node/install
_15
import twilio from "twilio";
_15
_15
// Find your Account SID and Auth Token at twilio.com/console
_15
// and set the environment variables. See http://twil.io/secure
_15
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_15
const authToken = process.env.TWILIO_AUTH_TOKEN;
_15
const client = twilio(accountSid, authToken);
_15
_15
const participant = await client.conversations.v1
_15
.conversations("ConversationSid")
_15
.participants("Sid")
_15
.update({ dateUpdated: new Date("2019-05-15 13:37:35") });
_15
_15
console.log(participant.accountSid);

Output

_18
{
_18
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18
"conversation_sid": "ConversationSid",
_18
"sid": "Sid",
_18
"identity": null,
_18
"attributes": "{ \"role\": \"driver\" }",
_18
"messaging_binding": {
_18
"type": "sms",
_18
"address": "+15558675310",
_18
"proxy_address": "+15017122661"
_18
},
_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
_18
}

Update attributes for a Conversation Participant

update-attributes-for-a-conversation-participant page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_15
// Download the helper library from https://www.twilio.com/docs/node/install
_15
import twilio from "twilio";
_15
_15
// Find your Account SID and Auth Token at twilio.com/console
_15
// and set the environment variables. See http://twil.io/secure
_15
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_15
const authToken = process.env.TWILIO_AUTH_TOKEN;
_15
const client = twilio(accountSid, authToken);
_15
_15
const participant = await client.conversations.v1
_15
.conversations("ConversationSid")
_15
.participants("Sid")
_15
.update({ attributes: '{"role": "driver"}' });
_15
_15
console.log(participant.accountSid);

Output

_18
{
_18
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18
"conversation_sid": "ConversationSid",
_18
"sid": "Sid",
_18
"identity": null,
_18
"attributes": "{\"role\": \"driver\"}",
_18
"messaging_binding": {
_18
"type": "sms",
_18
"address": "+15558675310",
_18
"proxy_address": "+15017122661"
_18
},
_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
_18
}


Delete a ConversationParticipant resource

delete-a-conversationparticipant-resource page anchor
DELETE https://conversations.twilio.com/v1/Conversations/{ConversationSid}/Participants/{Sid}

Property nameTypeRequiredPIIDescription
X-Twilio-Webhook-Enabledenum<string>Optional

The X-Twilio-Webhook-Enabled HTTP request header

Possible values:
truefalse
Property nameTypeRequiredPIIDescription
ConversationSidstringrequired

The unique ID of the Conversation for this participant.


Sidstringrequired

A 34 character string that uniquely identifies this resource.

Delete Conversation Participant

delete-conversation-participant page anchor

Delete a Conversation Participant by SID

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

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


Rate this page: