Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
Creating a user
Ideally, user creation should happen on your backend using the REST API. For on-the-fly creation during development, use thecreateUser() method with a User object and your API Key.
- Java
- Kotlin
Updating a user
UseupdateUser() with a User object and API Key. Ideally done on your backend via the REST API.
- Java
- Kotlin
User object provided to the updateUser() method has the UID of the user to be updated.
Updating logged-in user
UseupdateCurrentUserDetails() to update the currently logged-in user’s profile. No API Key required.
- Java
- Kotlin
updateCurrentUserDetails() method, you can only update the logged-in user regardless of the UID passed. Also, it is not possible to update the role of a logged-in user.
Deleting a user
Deleting a user can only be achieved via the RESTful APIs. For more information, see the delete a user section.User Class
| Field | Editable | Information |
|---|---|---|
| uid | specified on user creation. Not editable after that | Unique identifier of the user |
| name | Yes | Display name of the user |
| avatar | Yes | URL to profile picture of the user |
| link | Yes | URL to profile page |
| role | Yes | User role of the user for role based access control |
| metadata | Yes | Additional information about the user as JSON |
| status | No | Status of the user. Could be either online/offline |
| statusMessage | Yes | Any custom status message that needs to be set for a user |
| lastActiveAt | No | The unix timestamp of the time the user was last active. |
| hasBlockedMe | No | A boolean that determines if the user has blocked the logged in user |
| blockedByMe | No | A boolean that determines if the logged in user has blocked the user |
| tags | Yes | A list of tags to identify specific users |
User Payload Structure
User Object
User Object
The
Sample User Object:
User object returned by SDK methods contains the following fields:| Parameter | Type | Description |
|---|---|---|
uid | String | Unique identifier of the user |
name | String | Display name of the user |
avatar | String | URL to user’s profile picture |
link | String | URL to user’s profile page |
role | String | User role for role-based access control |
metadata | JSONObject | Custom data set by developer. Can contain any key-value pairs |
status | String | User online status. Values: "online", "offline" |
statusMessage | String | Custom status message set by user |
lastActiveAt | long | Unix timestamp of last activity (milliseconds) |
hasBlockedMe | boolean | Whether this user has blocked the logged-in user |
blockedByMe | boolean | Whether the logged-in user has blocked this user |
tags | Array<String> | List of tags for user identification and filtering |
deactivatedAt | long | Unix timestamp when user was deactivated (0 if active) |
Next Steps
Authentication
Log users into CometChat after creating their accounts
Retrieve Users
Fetch user lists and search for specific users
User Presence
Track user online/offline status in real-time
Block Users
Implement user blocking and unblocking features