User Conversation Resource
The UserConversation resource lists the Conversations in which a particular User is an active Participant. Use this resource to:
- list a user's conversations, present or historical,
- mute a user’s push notifications for specific channels, or
- count a user’s unread messages
Please note that UnreadMessageCount returns a maximum value of 1000
UserConversation properties
Each UserConversation resource contains these properties.
Resource Properties in REST API format | |
---|---|
account_sid
|
The unique ID of the Account responsible for this conversation. |
chat_service_sid
|
The unique ID of the Conversation Service this conversation belongs to. |
conversation_sid
|
The unique ID of the Conversation for this User Conversation. |
unread_messages_count
|
The number of unread Messages in the Conversation for the Participant. |
last_read_message_index
|
The index of the last Message in the Conversation that the Participant has read. |
participant_sid
|
The unique ID of the participant the user conversation belongs to. |
user_sid
|
The unique string that identifies the User resource. |
friendly_name
|
The human-readable name of this conversation, limited to 256 characters. Optional. |
conversation_state
|
The current state of this User Conversation. One of |
timers
|
Timer date values representing state update for this conversation. |
attributes
|
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. |
date_created
|
The date that this conversation was created, given in ISO 8601 format. |
date_updated
|
The date that this conversation was last updated, given in ISO 8601 format. |
created_by
|
Identity of the creator of this Conversation. |
notification_level
|
The Notification Level of this User Conversation. One of |
unique_name
|
An application-defined string that uniquely identifies the Conversation resource. It can be used to address the resource in place of the resource's |
url
|
|
links
|
Contains absolute URLs to access the participant and conversation of this conversation. |
Fetch a specific conversation
https://conversations.twilio.com/v1/Users/{UserSid}/Conversations/{ConversationSid}
The {UserSid}
value can be either the sid
or the identity
of the User resource and the {ConversationSid}
value can be either the sid
or the unique_name
of the Conversation to fetch.
Parameters
Parameters in REST API format | |
---|---|
user_sid
Path
|
The unique SID identifier of the User resource. This value can be either the |
conversation_sid
Path
|
The unique SID identifier of the Conversation. This value can be either the |
Example 1
List All of a User's Conversations
https://conversations.twilio.com/v1/Users/{UserSid}/Conversations
The {UserSid}
value can be either the sid
or the identity
of the User resource to read UserConversation resources from.
Parameters
Parameters in REST API format | |
---|---|
user_sid
Path
|
The unique SID identifier of the User resource. This value can be either the |
Example 1
Set the NotificationLevel for a conversation
https://conversations.twilio.com/v1/Users/{UserSid}/Conversations/{ConversationSid}
The NotificationLevel
property expresses whether a user receives pushes for this conversation or not. This can be set separately for each user/conversation pair.
Parameters
Parameters in REST API format | |
---|---|
user_sid
Path
|
The unique SID identifier of the User resource. This value can be either the |
conversation_sid
Path
|
The unique SID identifier of the Conversation. This value can be either the |
notification_level
Optional
|
The Notification Level of this User Conversation. One of |
last_read_timestamp
Optional
|
The date of the last message read in conversation by the user, given in ISO 8601 format. |
last_read_message_index
Optional
|
The index of the last Message in the Conversation that the Participant has read. |
Example 1
Remove a User from one of their Conversations
https://conversations.twilio.com/v1/Users/{UserSid}/Conversations/{ConversationSid}
Parameters
Parameters in REST API format | |
---|---|
user_sid
Path
|
The unique SID identifier of the User resource. This value can be either the |
conversation_sid
Path
|
The unique SID identifier of the Conversation. This value can be either the |
Example 1
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.