Menu

Expand
Rate this page:

User Channel Resource

Programmable Chat has been deprecated and is no longer supported. Instead, we'll be focusing on the next generation of chat: Twilio Conversations. Find out more about the EOL process here.

If you're starting a new project, please visit the Conversations Docs to begin. If you've already built on Programmable Chat, please visit our Migration Guide to learn about how to switch.

The User Channel resource of Programmable Chat is a read-only resource that describes a Channel that the User is a Member of.

UserChannel properties

Each User Channel resource contains these properties.

Resource Properties in REST API format
account_sid
sid<AC> Not PII

The SID of the Account that created the User Channel resource.

service_sid
sid<IS> Not PII

The SID of the Service the User Channel resource is associated with.

channel_sid
sid<CH> Not PII

The SID of the Channel the User Channel resource belongs to.

user_sid
sid<US> Not PII

The SID of the User the User Channel belongs to.

member_sid
sid<MB> Not PII

The SID of a Member that represents the User on the Channel.

status
enum:channel_status Not PII

The status of the User on the Channel. Can be: joined, invited, or not_participating.

last_consumed_message_index
integer? Not PII

The index of the last Message in the Channel that the Member has read.

unread_messages_count
integer? Not PII

The number of unread Messages in the Channel for the User. Note that retrieving messages on a client endpoint does not mean that messages are consumed or read. See Consumption Horizon feature to learn how to mark messages as consumed.

links
uri_map Not PII

The absolute URLs of the Members, Messages , Invites and, if it exists, the last Message for the Channel.

url
url Not PII

The absolute URL of the User Channel resource.

notification_level
enum:notification_level Not PII

The push notification level of the User for the Channel. Can be: default or muted.

Fetch a UserChannel resource

get
https://chat.twilio.com/v2/Services/{ServiceSid}/Users/{UserSid}/Channels/{ChannelSid}

The {UserSid} value can be either the sid or the identity of the User resource and the {ChannelSid} value can be either the sid or the unique_name of the Channel to fetch.

Parameters
Parameters in REST API format
service_sid
Path
get sid<IS> Not PII

The SID of the Service to fetch the User Channel resource from.

user_sid
Path
get sid_like<US> Not PII

The SID of the User to fetch the User Channel resource from. This value can be either the sid or the identity of the User resource.

channel_sid
Path
get sid_like<CH> Not PII

The SID of the Channel that has the User Channel to fetch. This value can be either the sid or the unique_name of the Channel to fetch.

Example 1
Loading Code Sample...
        
        

        Fetch a UserChannel resource

        Read multiple UserChannel resources

        get
        https://chat.twilio.com/v2/Services/{ServiceSid}/Users/{UserSid}/Channels

        The {UserSid} value can be either the sid or the identity of the User resource to read User Channel resources from.

        Parameters
        Parameters in REST API format
        service_sid
        Path
        get sid<IS> Not PII

        The SID of the Service to read the User Channel resources from.

        user_sid
        Path
        get sid_like<US> Not PII

        The SID of the User to read the User Channel resources from. This value can be either the sid or the identity of the User resource.

        Example 1
        Loading Code Sample...
              
              

              Read multiple UserChannel resources

              Set the NotificationLevel

              post
              https://chat.twilio.com/v2/Services/{ServiceSid}/Users/{UserSid}/Channels/{ChannelSid}

              The NotificationLevel property expresses whether a user receives pushes for this channel or not. This can be set separately for each user/channel pair.

              Parameters
              Parameters in REST API format
              service_sid
              Path
              post sid<IS> Not PII

              The SID of the Service to update the User Channel resource in.

              user_sid
              Path
              post sid_like<US> Not PII

              The SID of the User to update the User Channel resource from. This value can be either the sid or the identity of the User resource.

              channel_sid
              Path
              post sid_like<CH> Not PII

              The SID of the Channel with the User Channel resource to update. This value can be the Channel resource's sid or unique_name.

              notification_level
              Optional
              post ienum:notification_level Not PII

              The push notification level to assign to the User Channel. Can be: default or muted.

              last_consumed_message_index
              Optional
              post integer? Not PII

              The index of the last Message in the Channel that the Member has read.

              last_consumption_timestamp
              Optional
              post date_time<iso8601> Not PII

              The ISO 8601 timestamp of the last Message read event for the Member within the Channel.

              Example 1
              Loading Code Sample...
                    
                    

                    Mute Notifications for a Channel

                    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