Skip to main content
This page documents the entity classes used across all CometChat SDKs. All entity objects share the same structure regardless of platform. All properties are accessed via getter methods.

User

User represents a CometChat user. It is returned by methods like CometChat.login(), CometChat.getUser(), and user list requests.

Properties

PropertyGetterReturn TypeDescription
uidgetUid()stringUnique user ID
namegetName()stringDisplay name of the user
avatargetAvatar()stringURL of the user’s avatar image
linkgetLink()stringURL link associated with the user
rolegetRole()stringRole assigned to the user
metadatagetMetadata()ObjectCustom metadata attached to the user
statusgetStatus()stringOnline status of the user ("online" or "offline")
statusMessagegetStatusMessage()stringCustom status message set by the user
lastActiveAtgetLastActiveAt()numberTimestamp when the user was last active (epoch seconds)
tagsgetTags()string[]Tags associated with the user
deactivatedAtgetDeactivatedAt()numberTimestamp 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.
PropertyGetterReturn TypeDescription
hasBlockedMegetHasBlockedMe()booleanWhether this user has blocked the logged-in user
blockedByMegetBlockedByMe()booleanWhether the logged-in user has blocked this user
authTokengetAuthToken()stringAuth 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

PropertyGetterReturn TypeDescription
guidgetGuid()stringUnique group ID
namegetName()stringDisplay name of the group
typegetType()stringGroup type ("public", "private", or "password")
icongetIcon()stringURL of the group icon
descriptiongetDescription()stringDescription of the group
ownergetOwner()stringUID of the group owner
metadatagetMetadata()ObjectCustom metadata attached to the group
createdAtgetCreatedAt()numberTimestamp when the group was created (epoch seconds)
updatedAtgetUpdatedAt()numberTimestamp when the group was last updated (epoch seconds)
hasJoinedgetHasJoined()booleanWhether the logged-in user has joined this group
scopegetScope()stringScope of the logged-in user in the group ("admin", "moderator", or "participant")
joinedAtgetJoinedAt()stringTimestamp when the logged-in user joined the group
membersCountgetMembersCount()numberTotal number of members in the group
tagsgetTags()string[]Tags associated with the group

Conditional Properties

PropertyGetterReturn TypeDescription
passwordgetPassword()stringGroup password (only for password-protected groups, only available during creation)
isBannedisBannedFromGroup()booleanWhether 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

PropertyGetterReturn TypeDescription
conversationIdgetConversationId()stringUnique conversation ID
conversationTypegetConversationType()stringType of conversation ("user" or "group")
lastMessagegetLastMessage()BaseMessageThe last message in the conversation
conversationWithgetConversationWith()User | GroupThe user or group this conversation is with
unreadMessageCountgetUnreadMessageCount()numberNumber of unread messages in the conversation
unreadMentionsCountgetUnreadMentionsCount()numberNumber of unread mentions in the conversation
lastReadMessageIdgetLastReadMessageId()stringID of the last message read by the logged-in user
latestMessageIdgetLatestMessageId()stringID of the latest message in the conversation
tagsgetTags()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

PropertyGetterReturn TypeDescription
scopegetScope()stringScope of the member in the group ("admin", "moderator", or "participant")
joinedAtgetJoinedAt()numberTimestamp when the member joined the group (epoch seconds)
guidgetGuid()stringGUID of the group this member belongs to