Each service-scoped Participant in a Conversation represents one real (probably human) participant in a non-default, service-scoped Conversation.
All URLs in the reference documentation use the following base URL:
1https://conversations.twilio.com/v12
For Conversations applications that build on more than one Conversation Service instance, you will need to specify the Conversation Service SID (ISxx
) and the Conversation SID (CHxx
) in the REST API call:
1GET /v1/Services/ISxx/Conversations/CHxx/Messages2
The unique ID of the Account responsible for this participant.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Conversation Service the Participant resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique ID of the Conversation for this participant.
^CH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
A 34 character string that uniquely identifies this resource.
^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 Conversation 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.
^RL[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Index of last “read” message in the Conversation for the Participant.
Timestamp of last “read” message in the Conversation for the Participant.
POST https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants
Creating a Participant joins them to the Conversation, and the connected person will receive all subsequent messages.
The X-Twilio-Webhook-Enabled HTTP request header
true
false
The SID of the Conversation Service the Participant resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique ID of the Conversation for this participant.
application/x-www-form-urlencoded
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 Conversation SDK to communicate. Limited to 256 characters.
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).
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).
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 address of the Twilio phone number that is used in Group MMS.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createServiceConversationParticipant() {11const participant = await client.conversations.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.conversations("ConversationSid")14.participants.create();1516console.log(participant.accountSid);17}1819createServiceConversationParticipant();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"conversation_sid": "ConversationSid",5"sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"identity": "null",7"attributes": "{ \"role\": \"driver\" }",8"messaging_binding": {9"type": "sms",10"address": "+15558675310",11"proxy_address": "+15017122661"12},13"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"date_created": "2015-12-16T22:18:37Z",15"date_updated": "2015-12-16T22:18:38Z",16"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"last_read_message_index": null,18"last_read_timestamp": null19}
GET https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants/{Sid}
The SID of the Conversation Service the Participant resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
A 34 character string that uniquely identifies this resource. Alternatively, you can pass a Participant's identity
rather than the SID.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchServiceConversationParticipant() {11const participant = await client.conversations.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.conversations("ConversationSid")14.participants("Sid")15.fetch();1617console.log(participant.accountSid);18}1920fetchServiceConversationParticipant();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"conversation_sid": "ConversationSid",5"sid": "Sid",6"identity": null,7"attributes": "{ \"role\": \"driver\" }",8"messaging_binding": {9"type": "sms",10"address": "+15558675310",11"proxy_address": "+15017122661"12},13"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"date_created": "2016-03-24T21:05:50Z",15"date_updated": "2016-03-24T21:05:50Z",16"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"last_read_message_index": null,18"last_read_timestamp": null19}
You can also fetch a Service-Scoped Conversation Participant by their identity
. Pass their identity
as the value for the sid
argument.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchServiceConversationParticipant() {11const participant = await client.conversations.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.conversations("ConversationSid")14.participants("alice")15.fetch();1617console.log(participant.accountSid);18}1920fetchServiceConversationParticipant();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"conversation_sid": "ConversationSid",5"sid": "alice",6"identity": "alice",7"attributes": "{ \"role\": \"driver\" }",8"messaging_binding": {9"type": "sms",10"address": "+15558675310",11"proxy_address": "+15017122661"12},13"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"date_created": "2016-03-24T21:05:50Z",15"date_updated": "2016-03-24T21:05:50Z",16"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"last_read_message_index": null,18"last_read_timestamp": null19}
GET https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants
The SID of the Conversation Service the Participant resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique ID of the Conversation for participants.
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listServiceConversationParticipant() {11const participants = await client.conversations.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.conversations("ConversationSid")14.participants.list({ limit: 20 });1516participants.forEach((p) => console.log(p.accountSid));17}1819listServiceConversationParticipant();
1{2"meta": {3"page": 0,4"page_size": 50,5"first_page_url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0",6"previous_page_url": null,7"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants?PageSize=50&Page=0",8"next_page_url": null,9"key": "participants"10},11"participants": [12{13"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"identity": null,18"attributes": "{ \"role\": \"driver\" }",19"messaging_binding": {20"type": "sms",21"address": "+15558675310",22"proxy_address": "+15017122661"23},24"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"date_created": "2016-03-24T21:05:50Z",26"date_updated": "2016-03-24T21:05:50Z",27"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",28"last_read_message_index": null,29"last_read_timestamp": null30},31{32"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",33"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",34"conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",35"sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",36"identity": "IDENTITY",37"attributes": "{ \"role\": \"driver\" }",38"messaging_binding": null,39"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",40"date_created": "2016-03-24T21:05:50Z",41"date_updated": "2016-03-24T21:05:50Z",42"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",43"last_read_message_index": null,44"last_read_timestamp": null45}46]47}
POST https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants/{Sid}
The X-Twilio-Webhook-Enabled HTTP request header
true
false
The SID of the Conversation Service the Participant resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
A 34 character string that uniquely identifies this resource.
application/x-www-form-urlencoded
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 Conversation 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.
The SID of a conversation-level Role to assign to the participant.
^RL[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The address of the Twilio phone number that the participant is in contact with. 'null' value will remove it.
The address of the Twilio phone number that is used in Group MMS. 'null' value will remove it.
Index of last “read” message in the Conversation for the Participant.
Timestamp of last “read” message in the Conversation for the Participant.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function updateServiceConversationParticipant() {11const participant = await client.conversations.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.conversations("ConversationSid")14.participants("Sid")15.update({ dateCreated: new Date("2009-07-06 20:30:00") });1617console.log(participant.accountSid);18}1920updateServiceConversationParticipant();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"conversation_sid": "ConversationSid",5"sid": "Sid",6"identity": null,7"attributes": "{ \"role\": \"driver\" }",8"messaging_binding": {9"type": "sms",10"address": "+15558675310",11"proxy_address": "+15017122661"12},13"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"date_created": "2009-07-06T20:30:00Z",15"date_updated": "2015-12-16T22:18:38Z",16"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"last_read_message_index": null,18"last_read_timestamp": null19}
DELETE https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants/{Sid}
Deleting a participant removes them from the Conversation; they will receive no new messages after that point.
The X-Twilio-Webhook-Enabled HTTP request header
true
false
The SID of the Conversation Service the Participant resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
A 34 character string that uniquely identifies this resource.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function deleteServiceConversationParticipant() {11await client.conversations.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.conversations("ConversationSid")14.participants("Sid")15.remove();16}1718deleteServiceConversationParticipant();