Menu

Expand
Rate this page:

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
sid<AC> Not PII

The unique ID of the Account responsible for this conversation.

chat_service_sid
sid<IS> Not PII

The unique ID of the Conversation Service this conversation belongs to.

conversation_sid
sid<CH> Not PII

The unique ID of the Conversation for this User Conversation.

unread_messages_count
integer? Not PII

The number of unread Messages in the Conversation for the Participant.

last_read_message_index
integer? Not PII

The index of the last Message in the Conversation that the Participant has read.

participant_sid
sid<MB> Not PII

The unique ID of the participant the user conversation belongs to.

user_sid
sid<US> Not PII

The unique string that identifies the User resource.

friendly_name

The human-readable name of this conversation, limited to 256 characters. Optional.

conversation_state
enum:state Not PII

The current state of this User Conversation. One of inactive, active or closed.

timers
object Not PII

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
date_time<iso8601> Not PII

The date that this conversation was created, given in ISO 8601 format.

date_updated
date_time<iso8601> Not PII

The date that this conversation was last updated, given in ISO 8601 format.

created_by
string Not PII

Identity of the creator of this Conversation.

notification_level
enum:notification_level Not PII

The Notification Level of this User Conversation. One of default or muted.

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 conversation_sid in the URL.

url
url Not PII

links
uri_map Not PII

Contains absolute URLs to access the participant and conversation of this conversation.

Fetch a specific conversation

get
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
get sid_like<US> Not PII

The unique SID identifier of the User resource. This value can be either the sid or the identity of the User resource.

conversation_sid
Path
get sid_like<CH> Not PII

The unique SID identifier of the Conversation. This value can be either the sid or the unique_name of the Conversation resource.

Example 1
Loading Code Sample...
        
        

        Fetch a specific conversation

        List All of a User's Conversations

        get
        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
        get sid_like<US> Not PII

        The unique SID identifier of the User resource. This value can be either the sid or the identity of the User resource.

        Example 1
        Loading Code Sample...
              
              

              List All of a User's Conversations

              Set the NotificationLevel for a conversation

              post
              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
              post sid_like<US> Not PII

              The unique SID identifier of the User resource. This value can be either the sid or the identity of the User resource.

              conversation_sid
              Path
              post sid_like<CH> Not PII

              The unique SID identifier of the Conversation. This value can be either the sid or the unique_name of the Conversation resource.

              notification_level
              Optional
              post ienum:notification_level Not PII

              The Notification Level of this User Conversation. One of default or muted.

              last_read_timestamp
              Optional
              post date_time<iso8601> Not PII

              The date of the last message read in conversation by the user, given in ISO 8601 format.

              last_read_message_index
              Optional
              post integer? Not PII

              The index of the last Message in the Conversation that the Participant has read.

              Example 1
              Loading Code Sample...
                    
                    

                    Mute Notifications for a Conversation

                    Remove a User from one of their Conversations

                    delete
                    https://conversations.twilio.com/v1/Users/{UserSid}/Conversations/{ConversationSid}
                    Parameters
                    Parameters in REST API format
                    user_sid
                    Path
                    delete sid_like<US> Not PII

                    The unique SID identifier of the User resource. This value can be either the sid or the identity of the User resource.

                    conversation_sid
                    Path
                    delete sid_like<CH> Not PII

                    The unique SID identifier of the Conversation. This value can be either the sid or the unique_name of the Conversation resource.

                    Example 1
                    Loading Code Sample...
                          
                          

                          Remove a User from one of their Conversations

                          Rate this page:

                          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.

                          Loading Code Sample...
                                
                                
                                

                                Thank you for your feedback!

                                Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                                Sending your feedback...
                                🎉 Thank you for your feedback!
                                Something went wrong. Please try again.

                                Thanks for your feedback!

                                thanks-feedback-gif