Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Users Resource

The User resource of Programmable Chat represents a particular user represented by an Identity as provided by the developer. Users exist within a single Chat Service instance. Users need to be unique (by Identity) within a Service instance.

User records are used to assign permissions via Roles within a Service instance and determine what the user can and cannot do within the instance.

Users can be created within a Service instance via the client capability token or via the User resource REST API methods.

The first time a new Identity is encountered by Chat within a Service instance, a new User instance will be created using the Identity encountered.
If the Identity exists, the existing User record will be used for that session/request. This is true for endpoints and Access Tokens, and for creating Members in a POST to the Members resource.

Users can also be retrieved by either User Sid or Identity via a GET to the Users resource.

Properties

Each user has these properties:

Names in PHP format
sid
sid<US> Not PII

The unique string that we created to identify the User resource.

accountSid
sid<AC> Not PII

The SID of the Account that created the User resource.

serviceSid
sid<IS> Not PII

The SID of the Service the resource is associated with.

attributes

The JSON string that stores application-specific data. Note If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, {} is returned.

friendlyName

The string that you assigned to describe the resource.

roleSid
sid<RL> Not PII

The SID of the Role assigned to the user.

identity

The application-defined string that uniquely identifies the resource's User within the Service. This value is often a username or an email address. See access tokens for more info.

isOnline
boolean Not PII

Whether the User is actively connected to the Service instance and online. This value is only returned by Fetch actions that return a single resource and null is always returned by a Read action. This value is null if the Service's reachability_enabled is false, if the User has never been online for the Service instance, even if the Service's reachability_enabled is true.

isNotifiable
boolean Not PII

Whether the User has a potentially valid Push Notification registration (APN or GCM) for the Service instance. If at least one registration exists, true; otherwise false. This value is only returned by Fetch actions that return a single resource and null is always returned by a Read action. This value is null if the Service's reachability_enabled is false, and if the User has never had a notification registration, even if the Service's reachability_enabled is true.

dateCreated
date_time<iso8601> Not PII

The date and time in GMT when the resource was created specified in RFC 2822 format.

dateUpdated
date_time<iso8601> Not PII

The date and time in GMT when the resource was last updated specified in RFC 2822 format.

joinedChannelsCount
integer Not PII

The number of Channels this User is a Member of.

links
uri_map Not PII

The absolute URLs of the Channel and Binding resources related to the user.

url
url Not PII

The absolute URL of the User resource.

List All Users

GET /Services/{Service SID}/Users
        
        
        
        

        Create a User

        POST /Services/{Service SID}/Users
        

        Parameters

        Names in PHP format
        serviceSid
        Required
        post sid<IS> Not PII

        The SID of the Service to create the resource under.

        identity
        Required
        post string PII MTL: 120 DAYS

        The identity value that uniquely identifies the new resource's User within the Service. This value is often a username or email address. See the Identity documentation for more details.

        roleSid
        Optional
        post sid<RL> Not PII

        The SID of the Role assigned to the new User.

        attributes
        Optional
        post string PII MTL: 120 DAYS

        A valid JSON string that contains application-specific data.

        friendlyName
        Optional
        post string PII MTL: 120 DAYS

        A descriptive string that you create to describe the new resource. This value is often used for display purposes.

              
              
              
              

              Retrieve a User

              With Identity

              GET /Services/{Service SID}/Users/{Identity}
              

              With User Sid

              GET /Services/{Service SID}/Users/{User SID}
              
                    
                    
                    
                    

                    Update a User

                    POST /Services/{Service SID}/Users/{User SID}
                    

                    Parameters

                    Names in PHP format
                    serviceSid
                    Required
                    post sid<IS> Not PII

                    The SID of the Service to update the resource from.

                    sid
                    Required
                    post sid_like<US> Not PII

                    The Twilio-provided string that uniquely identifies the User resource to update.

                    roleSid
                    Optional
                    post sid<RL> Not PII

                    The SID of the Role assigned to this user.

                    attributes
                    Optional
                    post string PII MTL: 120 DAYS

                    A valid JSON string that contains application-specific data.

                    friendlyName
                    Optional
                    post string PII MTL: 120 DAYS

                    A descriptive string that you create to describe the resource. It is often used for display purposes.

                          
                          
                          
                          

                          Delete a User

                          DELETE /Services/{Service SID}/Users/{User SID}
                          
                                
                                
                                
                                
                                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 browsing the Twilio tag on Stack Overflow.