User object
User
is an object that refers to a single user in a chat.
Properties
The User
interface has the following properties:
interface User {
val chat: Chat
val id: String
val name: String?
val externalId: String?
val profileUrl: String?
val email: String?
val custom: Map<String, Any?>?
val status: String?
val type: String?
val updated: String?
val lastActiveTimestamp: Long?
}
Parameter | Type | Description |
---|---|---|
chat | Chat | Reference to the main Chat object. |
id | String | Unique ID of the user. |
name | String | Display name or username of the user (must not be empty or consist only of whitespace characters). |
externalId | String | Identifier for the user from an external system, such as a third-party authentication provider or a user directory. |
profileUrl | String | URL to the user's profile or avatar image. |
email | String | User's email address. |
custom | Map<String, Any?> | Any custom properties or metadata associated with the user in the form of a JSON. App Context filtering language doesn’t support filtering by custom properties. |
status | String | Current status of the user, like online , offline , or away . |
type | String | Type of the user, like admin , member , guest . |
updated | String | Timestamp (a number of milliseconds since January 1, 1970) for the last time the user information was updated or modified. |
lastActiveTimestamp | Long | Timestamp for the last time the user was active in a chat app. |
API limits
To learn about the maximum length of parameters used to set user metadata, refer to REST API docs.
Methods
You can call the following methods on the User
object.
Click on each method for more details.
active()
delete()
getChannelRestrictions()
getChannelsRestrictions()
getMemberships()
isPresentOn()
setRestrictions()
streamUpdates()
streamUpdatesOn()
update()
wherePresent()
Use case
For example, you can use the User
object methods to:
- Create and manage users.
- Let users configure their channel membership.
- Mention others in a conversation.
- Check when was the last time users were online in an app.