The ParticipantConversation resource lists all the Conversations for a specific participant. It performs the lookup using an exact match to the participant identifier.
This resource supports the lookup of conversations for a specific participant based on two types of query parameters:
Users can provide only one parameter at a time, i.e. either identity
or address
. The returned data will be sorted by the conversationSid
alphabetically.
Each Participant Conversation resource contains these properties.
The unique ID of the Account responsible for this conversation.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique ID of the Conversation Service this conversation belongs to.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique ID of the Participant.
^MB[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique string that identifies the conversation participant as Conversation User.
^US[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.
Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant.
The unique ID of the Conversation this Participant belongs to.
^CH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
An application-defined string that uniquely identifies the Conversation resource.
The human-readable name of this conversation, limited to 256 characters. Optional.
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 date that this conversation was created, given in ISO 8601 format.
The date that this conversation was last updated, given in ISO 8601 format.
The current state of this User Conversation. One of inactive
, active
or closed
.
inactive
active
closed
Timer date values representing state update for this conversation.
Contains absolute URLs to access the participant and conversation of this conversation.
GET https://conversations.twilio.com/v1/ParticipantConversations
The ParticipantConversation resource also supports pagination via additional parameters like: PageSize
and PageToken
.
It's expected that you will encode the url for the ParticipantConversations endpoint, for example, if a phone number is passed as an address parameter the +
character should be encoded as %2B
.
In the Group MMS use case, it may happen that the participant might not have an identifier (no address
and no identity
). So, this endpoint will not return conversations for this participant. Similarly if the identity of this participant with Projected Address is created later then this endpoint will not return conversations to which this participant was added when it was without identity.
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.
A unique string identifier for the conversation participant who's not a Conversation User. This parameter could be found in messaging_binding.address field of Participant resource. It should be url-encoded.
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 listParticipantConversation() {11const participantConversations =12await client.conversations.v1.participantConversations.list({13address: "+375255555555",14limit: 20,15});1617participantConversations.forEach((p) => console.log(p.accountSid));18}1920listParticipantConversation();
1{2"conversations": [3{4"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",7"participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"conversation_friendly_name": "friendly_name",9"conversation_state": "inactive",10"conversation_timers": {11"date_inactive": "2015-12-16T22:19:38Z",12"date_closed": "2015-12-16T22:28:38Z"13},14"conversation_attributes": "{}",15"conversation_date_created": "2015-07-30T20:00:00Z",16"conversation_date_updated": "2015-07-30T20:00:00Z",17"conversation_created_by": "created_by",18"conversation_unique_name": "unique_name",19"participant_user_sid": null,20"participant_identity": null,21"participant_messaging_binding": {22"address": "+375255555555",23"proxy_address": "+12345678910",24"type": "sms",25"level": null,26"name": null,27"projected_address": null28},29"links": {30"participant": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",31"conversation": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"32}33}34],35"meta": {36"page": 0,37"page_size": 50,38"first_page_url": "https://conversations.twilio.com/v1/ParticipantConversations?Address=%2B375255555555&PageSize=50&Page=0",39"previous_page_url": null,40"url": "https://conversations.twilio.com/v1/ParticipantConversations?Address=%2B375255555555&PageSize=50&Page=0",41"next_page_url": null,42"key": "conversations"43}44}