User
User represents a CometChat user. It is returned by methods like CometChat.login(), CometChat.getUser(), and user list requests.
Properties
| Property | Getter | Return Type | Description |
|---|---|---|---|
| uid | getUid() | string | Unique user ID |
| name | getName() | string | Display name of the user |
| avatar | getAvatar() | string | URL of the user’s avatar image |
| link | getLink() | string | URL link associated with the user |
| role | getRole() | string | Role assigned to the user |
| metadata | getMetadata() | Object | Custom metadata attached to the user |
| status | getStatus() | string | Online status of the user ("online" or "offline") |
| statusMessage | getStatusMessage() | string | Custom status message set by the user |
| lastActiveAt | getLastActiveAt() | number | Timestamp when the user was last active (epoch seconds) |
| tags | getTags() | string[] | Tags associated with the user |
| deactivatedAt | getDeactivatedAt() | number | Timestamp when the user was deactivated (epoch seconds) |
Conditional Properties
These properties may or may not be populated depending on the method or request configuration used.| Property | Getter | Return Type | Description |
|---|---|---|---|
| hasBlockedMe | getHasBlockedMe() | boolean | Whether this user has blocked the logged-in user |
| blockedByMe | getBlockedByMe() | boolean | Whether the logged-in user has blocked this user |
| authToken | getAuthToken() | string | Auth token of the user (only available after login) |
Group
Group represents a CometChat group. It is returned by methods like CometChat.createGroup(), CometChat.getGroup(), and group list requests.
Properties
| Property | Getter | Return Type | Description |
|---|---|---|---|
| guid | getGuid() | string | Unique group ID |
| name | getName() | string | Display name of the group |
| type | getType() | string | Group type ("public", "private", or "password") |
| icon | getIcon() | string | URL of the group icon |
| description | getDescription() | string | Description of the group |
| owner | getOwner() | string | UID of the group owner |
| metadata | getMetadata() | Object | Custom metadata attached to the group |
| createdAt | getCreatedAt() | number | Timestamp when the group was created (epoch seconds) |
| updatedAt | getUpdatedAt() | number | Timestamp when the group was last updated (epoch seconds) |
| hasJoined | getHasJoined() | boolean | Whether the logged-in user has joined this group |
| scope | getScope() | string | Scope of the logged-in user in the group ("admin", "moderator", or "participant") |
| joinedAt | getJoinedAt() | string | Timestamp when the logged-in user joined the group |
| membersCount | getMembersCount() | number | Total number of members in the group |
| tags | getTags() | string[] | Tags associated with the group |
Conditional Properties
| Property | Getter | Return Type | Description |
|---|---|---|---|
| password | getPassword() | string | Group password (only for password-protected groups, only available during creation) |
| isBanned | isBannedFromGroup() | boolean | Whether the logged-in user is banned from the group |
Conversation
Conversation represents a chat conversation. It is returned by CometChat.getConversation() and conversation list requests.
Properties
| Property | Getter | Return Type | Description |
|---|---|---|---|
| conversationId | getConversationId() | string | Unique conversation ID |
| conversationType | getConversationType() | string | Type of conversation ("user" or "group") |
| lastMessage | getLastMessage() | BaseMessage | The last message in the conversation |
| conversationWith | getConversationWith() | User | Group | The user or group this conversation is with |
| unreadMessageCount | getUnreadMessageCount() | number | Number of unread messages in the conversation |
| unreadMentionsCount | getUnreadMentionsCount() | number | Number of unread mentions in the conversation |
| lastReadMessageId | getLastReadMessageId() | string | ID of the last message read by the logged-in user |
| latestMessageId | getLatestMessageId() | string | ID of the latest message in the conversation |
| tags | getTags() | string[] | Tags associated with the conversation |
GroupMember
GroupMember extends User and represents a member of a CometChat group. It is returned by group member list requests.
It inherits all properties from User and adds the following.
Properties
| Property | Getter | Return Type | Description |
|---|---|---|---|
| scope | getScope() | string | Scope of the member in the group ("admin", "moderator", or "participant") |
| joinedAt | getJoinedAt() | number | Timestamp when the member joined the group (epoch seconds) |
| guid | getGuid() | string | GUID of the group this member belongs to |