Menu

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

A 34 character string that uniquely identifies this resource.

accountSid
sid<AC> Not PII

The unique id of the Account responsible for this user.

serviceSid
sid<IS> Not PII

The unique id of the Service this user belongs to.

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.

friendlyName

The human-readable name of this user. Optional.

roleSid
sid<RL> Not PII

The unique id of the [Role][role] assigned to this user.

identity

A unique string that identifies the user within this service - often a username or email address. See the identity docs for more details.

isOnline
boolean Not PII

Indicates whether the User is actively connected to the Service instance and online. true if online, false if not. Note that this will always be null for resources returned via LIST GET operations, but will be present for single GET operations. Note that this will be null if Reachability is not enabled for the Service instance. Note This will be null for Users that have not ever had been online for the Service instance, even if Reachability is enabled.

isNotifiable
boolean Not PII

Indicates whether the User has a potentially valid Push Notification registration (APN or GCM) for the Service instance. true if at least one registration exists, false if not. Note that this will always be null for resources returned via LIST GET operations, but will be present for single GET operations. Note that this will be null if Reachability is not enabled for the Service instance. Note This will be null for Users that have not ever had a notification registration for the Service instance, even if Reachability is enabled.

dateCreated
date_time<iso8601> Not PII

The date that this resource was created in ISO 8601 format.

dateUpdated
date_time<iso8601> Not PII

The date that this resource was last updated in ISO 8601 format.

joinedChannelsCount
integer Not PII

The number of Channels this User is a Member of.

links
uri_map Not PII

url
url Not PII

An absolute URL for this user.

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

        Sid of the Service this user belongs to.

        identity
        Required
        post string PII MTL: 120 DAYS

        A unique string that identifies the user within this service - often a username or email address. See the [identity][identity] docs for more details.

        roleSid
        Optional
        post sid<RL> Not PII

        The unique id of the Role assigned to this user.

        attributes
        Optional
        post string PII MTL: 120 DAYS

        An optional string used to contain any metadata or other information for the User. The string must contain structurally valid JSON if specified.

        friendlyName
        Optional
        post string PII MTL: 120 DAYS

        An optional human readable string representing the user. 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

                    Sid of the Service this user belongs to.

                    sid
                    Required
                    post sid_like<US> Not PII

                    Key that uniquely defines the user to update. Could be Sid or Identity.

                    roleSid
                    Optional
                    post sid<RL> Not PII

                    The unique id of the [Role][role] assigned to this user.

                    attributes
                    Optional
                    post string PII MTL: 120 DAYS

                    An optional string used to contain any metadata or other information for the User. The string must contain structurally valid JSON if specified.

                    friendlyName
                    Optional
                    post string PII MTL: 120 DAYS

                    An optional human readable string representing the user. Often used for display purposes.

                          
                          
                          
                          

                          Delete a User

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

                                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.