Skip to main content
Quick Reference for AI Agents & Developers
// Build a conversations request
let conversationsRequest = new CometChat.ConversationsRequestBuilder()
  .setLimit(30)
  .build();

// Fetch conversations (paginated)
conversationsRequest.fetchNext().then(
  conversationList => console.log("Conversations:", conversationList),
  error => console.log("Error:", error)
);

// Retrieve a single conversation
CometChat.getConversation("UID_OR_GUID", "user_or_group").then(
  conversation => console.log("Conversation:", conversation),
  error => console.log("Error:", error)
);
Conversations provide the last messages for every one-on-one and group conversation the logged-in user is a part of. This makes it easy for you to build a Recent Chat list.
Available via: SDK | REST API | UI Kits

Retrieve List of Conversations

In other words, as a logged-in user, how do I retrieve the latest conversations that I’ve been a part of? To fetch the list of conversations, you can use the ConversationsRequest class. To use this class i.e. to create an object of the ConversationsRequest class, you need to use the ConversationsRequestBuilder class. The ConversationsRequestBuilder class allows you to set the parameters based on which the conversations are to be fetched. The ConversationsRequestBuilder class allows you to set the below parameters:

Set Limit

This method sets the limit i.e. the number of conversations that should be fetched in a single iteration.
let limit = 30;
let conversationRequest = new CometChat.ConversationsRequestBuilder()
  .setLimit(limit)
  .build();  

Set Conversation Type

This method can be used to fetch user or group conversations specifically. The conversationType variable can hold one of the below two values:
  • user - Only fetches user conversation.
  • group - Only fetches group conversations.
If none is set, the list of conversations will include both user and group conversations.
let limit = 30;
let conversationType = "group";
let conversationRequest = new CometChat.ConversationsRequestBuilder()
  .setLimit(limit)
  .setConversationType(conversationType)
  .build();
On SuccessfetchNext() returns an array of Conversation objects (group conversations only):Conversation Object (per item in array):
ParameterTypeDescriptionSample Value
conversationIdstringUnique conversation identifier"group_group_1748415903905"
conversationTypestringType of conversation"group"
unreadMentionsCountnumberCount of unread mentions0
lastReadMessageIdstringID of last read message"25243"
unreadMessageCountnumberCount of unread messages0
latestMessageIdstringID of latest message"25243"
lastMessageobjectLast message in conversationSee below ↓
conversationWithobjectGroup detailsSee below ↓

lastMessage Object:
ParameterTypeDescriptionSample Value
idstringUnique message identifier"25243"
conversationIdstringConversation identifier"group_group_1748415903905"
receiverIdstringGroup’s GUID"group_1748415903905"
receiverTypestringType of receiver"group"
typestringMessage type"text"
categorystringMessage category"message"
textstringMessage text content"Susan here "
sentAtnumberUnix timestamp when sent1771413931
updatedAtnumberUnix timestamp when updated1771413931
senderobjectSender user detailsSee below ↓
receiverobjectReceiver group detailsSee below ↓
dataobjectAdditional message dataSee below ↓
metadataobjectMessage metadataSee below ↓
reactionsarrayMessage reactions[]
mentionedUsersarrayUsers mentioned in message[]
mentionedMebooleanWhether current user is mentionedfalse

lastMessage.sender Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-4"
namestringUser’s display name"Susan Marie"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-4.webp"
statusstringUser’s online status"online"
rolestringUser’s role"admin"
lastActiveAtnumberLast active timestamp1771413925
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.receiver Object (Group):
ParameterTypeDescriptionSample Value
guidstringGroup’s unique identifier"group_1748415903905"
namestringGroup’s display name"3 People Group"
typestringGroup type"public"
conversationIdstringConversation identifier"group_group_1748415903905"
ownerstringGroup owner’s UID"123456"
scopestringCurrent user’s scope in group"admin"
membersCountnumberTotal members in group12
onlineMembersCountnumberOnline members count3
hasJoinedbooleanWhether current user has joinedtrue
isBannedbooleanWhether current user is bannedfalse
joinedAtnumberTimestamp when user joined1748415973
createdAtnumberGroup creation timestamp1748415957
updatedAtnumberGroup update timestamp1771245340

lastMessage.data Object:
ParameterTypeDescriptionSample Value
textstringMessage text"Susan here "
resourcestringSDK resource identifier"REACT_NATIVE-4_0_12-..."
entitiesobjectSender and receiver entitiesSee below ↓
metadataobjectInjected metadataSee below ↓

lastMessage.data.entities Object:
ParameterTypeDescriptionSample Value
senderobjectSender entity wrapperSee below ↓
receiverobjectReceiver entity wrapperSee below ↓

lastMessage.data.entities.sender Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.sender.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-4"
namestringUser’s display name"Susan Marie"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-4.webp"
rolestringUser’s role"admin"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771413925
tagsarrayUser tags[]

lastMessage.data.entities.receiver Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"group"
entityobjectGroup entity detailsSee below ↓

lastMessage.data.entities.receiver.entity Object:
ParameterTypeDescriptionSample Value
guidstringGroup’s unique identifier"group_1748415903905"
namestringGroup’s display name"3 People Group"
typestringGroup type"public"
conversationIdstringConversation identifier"group_group_1748415903905"
ownerstringGroup owner’s UID"123456"
scopestringCurrent user’s scope in group"admin"
membersCountnumberTotal members in group12
onlineMembersCountnumberOnline members count3
hasJoinedbooleanWhether current user has joinedtrue
joinedAtnumberTimestamp when user joined1748415973
createdAtnumberGroup creation timestamp1748415957
updatedAtnumberGroup update timestamp1771245340

lastMessage.data.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.data.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.data.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.data.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

conversationWith Object (Group):
ParameterTypeDescriptionSample Value
guidstringGroup’s unique identifier"group_1748415903905"
namestringGroup’s display name"3 People Group"
typestringGroup type"public"
conversationIdstringConversation identifier"group_group_1748415903905"
ownerstringGroup owner’s UID"123456"
scopestringCurrent user’s scope in group"admin"
membersCountnumberTotal members in group12
onlineMembersCountnumberOnline members count1
hasJoinedbooleanWhether current user has joinedtrue
isBannedbooleanWhether current user is bannedfalse
joinedAtnumberTimestamp when user joined1748437105
createdAtnumberGroup creation timestamp1748415957
updatedAtnumberGroup update timestamp1771245340

With User and Group Tags

This method can be used to fetch the user/group tags in the Conversation Object. By default the value is false.
let limit = 30;
let conversationRequest = new CometChat.ConversationsRequestBuilder()
  .setLimit(limit)
  .withUserAndGroupTags(true)
  .build();
withUserAndGroupTags(true) adds the tags array to the conversationWith object (user/group tags). The tags you see inside lastMessage.data.entities and sender/receiver are part of the message payload, not the conversation’s conversationWith object.
On SuccessfetchNext() returns an array of Conversation objects with user/group tags:Conversation Object (per item in array):
ParameterTypeDescriptionSample Value
conversationIdstringUnique conversation identifier"cometchat-uid-2_user_cometchat-uid-3"
conversationTypestringType of conversation"user"
unreadMentionsCountnumberCount of unread mentions0
lastReadMessageIdstringID of last read message"25276"
unreadMessageCountnumberCount of unread messages0
latestMessageIdstringID of latest message"25276"
lastMessageobjectLast message in conversationSee below ↓
conversationWithobjectUser details with tagsSee below ↓

lastMessage Object:
ParameterTypeDescriptionSample Value
idstringUnique message identifier"25276"
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"
receiverIdstringReceiver’s UID"cometchat-uid-2"
receiverTypestringType of receiver"user"
typestringMessage type"text"
categorystringMessage category"message"
textstringMessage text content"Message for mentioned users, Hello <@uid:cometchat-uid-2>"
sentAtnumberUnix timestamp when sent1771495242
deliveredAtnumberUnix timestamp when delivered1771495244
readAtnumberUnix timestamp when read1771495244
updatedAtnumberUnix timestamp when updated1771495244
senderobjectSender user detailsSee below ↓
receiverobjectReceiver user detailsSee below ↓
dataobjectAdditional message dataSee below ↓
metadataobjectMessage metadataSee below ↓
reactionsarrayMessage reactions[]
mentionedUsersarrayUsers mentioned in messageSee below ↓
mentionedMebooleanWhether current user is mentionedtrue

lastMessage.mentionedUsers Array (per item):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"offline"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771738926
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0

lastMessage.sender Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771495034
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags["userTag2"]

lastMessage.receiver Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771494233
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags["userTag1"]

lastMessage.data Object:
ParameterTypeDescriptionSample Value
textstringMessage text"Message for mentioned users, Hello <@uid:cometchat-uid-2>"
resourcestringSDK resource identifier"REACT_NATIVE-4_0_14-..."
mentionsobjectMap of mentioned users by UIDSee below ↓
entitiesobjectSender and receiver entitiesSee below ↓
metadataobjectInjected metadataSee below ↓

lastMessage.data.mentions Object (keyed by UID):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771494233

lastMessage.data.entities Object:
ParameterTypeDescriptionSample Value
senderobjectSender entity wrapperSee below ↓
receiverobjectReceiver entity wrapperSee below ↓

lastMessage.data.entities.sender Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.sender.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771495034
tagsarrayUser tags["userTag2"]

lastMessage.data.entities.receiver Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.receiver.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771494233
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"
tagsarrayUser tags["userTag1"]

lastMessage.data.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.data.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.data.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.data.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

conversationWith Object (User with tags):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771818451
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags (added by withUserAndGroupTags)["userTag2"]
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"

Set User Tags

This method fetches user conversations that have the specified tags.
let limit = 30;
let userTags = ["tag1"];
let conversationRequest = new CometChat.ConversationsRequestBuilder()
  .setLimit(limit)
  .setUserTags(userTags)
  .build();
On SuccessfetchNext() returns an array of Conversation objects filtered by user tags:Conversation Object (per item in array):
ParameterTypeDescriptionSample Value
conversationIdstringUnique conversation identifier"cometchat-uid-2_user_cometchat-uid-5"
conversationTypestringType of conversation"user"
unreadMentionsCountnumberCount of unread mentions0
lastReadMessageIdstringID of last read message"24957"
unreadMessageCountnumberCount of unread messages0
latestMessageIdstringID of latest message"24957"
lastMessageobjectLast message in conversationSee below ↓
conversationWithobjectUser detailsSee below ↓

lastMessage Object:
ParameterTypeDescriptionSample Value
idstringUnique message identifier"24955"
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-5"
receiverIdstringReceiver’s UID"cometchat-uid-2"
receiverTypestringType of receiver"user"
typestringMessage type"text"
categorystringMessage category"message"
textstringMessage text content"Not yet, I will update you if any."
sentAtnumberUnix timestamp when sent1770973162
editedAtnumberUnix timestamp when edited1770973219
editedBystringUID of user who edited"cometchat-uid-5"
updatedAtnumberUnix timestamp when updated1770973219
senderobjectSender user detailsSee below ↓
receiverobjectReceiver user detailsSee below ↓
dataobjectAdditional message dataSee below ↓
metadataobjectMessage metadataSee below ↓
reactionsarrayMessage reactions[]
mentionedUsersarrayUsers mentioned in message[]
mentionedMebooleanWhether current user is mentionedfalse

lastMessage.sender Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-5"
namestringUser’s display name"John Paul"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-5.webp"
statusstringUser’s online status"online"
rolestringUser’s role"admin"
lastActiveAtnumberLast active timestamp1770973064
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags["tag1"]

lastMessage.receiver Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"offline"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1770973150
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags["tag1"]

lastMessage.data Object:
ParameterTypeDescriptionSample Value
textstringMessage text"Not yet, I will update you if any."
resourcestringSDK resource identifier"REACT_NATIVE-4_0_14-..."
entitiesobjectSender and receiver entitiesSee below ↓
metadataobjectInjected metadataSee below ↓

lastMessage.data.entities Object:
ParameterTypeDescriptionSample Value
senderobjectSender entity wrapperSee below ↓
receiverobjectReceiver entity wrapperSee below ↓

lastMessage.data.entities.sender Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.sender.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-5"
namestringUser’s display name"John Paul"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-5.webp"
rolestringUser’s role"admin"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1770973064
tagsarrayUser tags["tag1"]

lastMessage.data.entities.receiver Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.receiver.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
rolestringUser’s role"default"
statusstringUser’s online status"offline"
lastActiveAtnumberLast active timestamp1770973150
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-5"
tagsarrayUser tags["tag1"]

lastMessage.data.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.data.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.data.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.data.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

conversationWith Object (User):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-5"
namestringUser’s display name"John Paul"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-5.webp"
statusstringUser’s online status"offline"
rolestringUser’s role"admin"
lastActiveAtnumberLast active timestamp1771668031
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-5"

Set Group Tags

This method fetches group conversations that have the specified tags.
let limit = 30;
let groupTags = ["tag1"];
let conversationRequest = new CometChat.ConversationsRequestBuilder()
  .setLimit(limit)
  .setGroupTags(groupTags)
  .build(); 
On SuccessfetchNext() returns an array of Conversation objects filtered by group tags:Conversation Object (per item in array):
ParameterTypeDescriptionSample Value
conversationIdstringUnique conversation identifier"group_group_1748415903905"
conversationTypestringType of conversation"group"
unreadMentionsCountnumberCount of unread mentions0
lastReadMessageIdstringID of last read message"25243"
unreadMessageCountnumberCount of unread messages0
latestMessageIdstringID of latest message"25243"
lastMessageobjectLast message in conversationSee below ↓
conversationWithobjectGroup detailsSee below ↓

lastMessage Object:
ParameterTypeDescriptionSample Value
idstringUnique message identifier"25243"
conversationIdstringConversation identifier"group_group_1748415903905"
receiverIdstringGroup’s GUID"group_1748415903905"
receiverTypestringType of receiver"group"
typestringMessage type"text"
categorystringMessage category"message"
textstringMessage text content"Susan here "
sentAtnumberUnix timestamp when sent1771413931
updatedAtnumberUnix timestamp when updated1771413931
senderobjectSender user detailsSee below ↓
receiverobjectReceiver group detailsSee below ↓
dataobjectAdditional message dataSee below ↓
metadataobjectMessage metadataSee below ↓
reactionsarrayMessage reactions[]
mentionedUsersarrayUsers mentioned in message[]
mentionedMebooleanWhether current user is mentionedfalse

lastMessage.sender Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-4"
namestringUser’s display name"Susan Marie"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-4.webp"
statusstringUser’s online status"online"
rolestringUser’s role"admin"
lastActiveAtnumberLast active timestamp1771413925
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.receiver Object (Group with tags):
ParameterTypeDescriptionSample Value
guidstringGroup’s unique identifier"group_1748415903905"
namestringGroup’s display name"3 People Group"
typestringGroup type"public"
tagsarrayGroup tags["tag1"]
conversationIdstringConversation identifier"group_group_1748415903905"
ownerstringGroup owner’s UID"123456"
scopestringCurrent user’s scope in group"admin"
membersCountnumberTotal members in group12
onlineMembersCountnumberOnline members count3
hasJoinedbooleanWhether current user has joinedtrue
isBannedbooleanWhether current user is bannedfalse
joinedAtnumberTimestamp when user joined1748415973
createdAtnumberGroup creation timestamp1748415957
updatedAtnumberGroup update timestamp1771245340

conversationWith Object (Group):
ParameterTypeDescriptionSample Value
guidstringGroup’s unique identifier"group_1748415903905"
namestringGroup’s display name"3 People Group"
typestringGroup type"public"
conversationIdstringConversation identifier"group_group_1748415903905"
ownerstringGroup owner’s UID"123456"
scopestringCurrent user’s scope in group"admin"
membersCountnumberTotal members in group12
onlineMembersCountnumberOnline members count1
hasJoinedbooleanWhether current user has joinedtrue
isBannedbooleanWhether current user is bannedfalse
joinedAtnumberTimestamp when user joined1748437105
createdAtnumberGroup creation timestamp1748415957
updatedAtnumberGroup update timestamp1771820149
updatedBystringUID of user who last updated"cometchat-uid-2"

With Tags

This method makes sure that the tags associated with the conversations are returned along with the other details of the conversations. The default value for this parameter is false.
let limit = 30;
let conversationRequest = new CometChat.ConversationsRequestBuilder()
  .setLimit(limit)
  .withTags(true)
  .build();
On SuccessfetchNext() returns an array of Conversation objects with conversation tags:Conversation Object (per item in array):
ParameterTypeDescriptionSample Value
conversationIdstringUnique conversation identifier"cometchat-uid-2_user_cometchat-uid-3"
conversationTypestringType of conversation"user"
unreadMentionsCountnumberCount of unread mentions0
lastReadMessageIdstringID of last read message"25276"
unreadMessageCountnumberCount of unread messages0
latestMessageIdstringID of latest message"25276"
tagsarrayConversation tags (added by withTags)["archivedChat"]
lastMessageobjectLast message in conversationSee below ↓
conversationWithobjectUser detailsSee below ↓

lastMessage Object:
ParameterTypeDescriptionSample Value
idstringUnique message identifier"25276"
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"
receiverIdstringReceiver’s UID"cometchat-uid-2"
receiverTypestringType of receiver"user"
typestringMessage type"text"
categorystringMessage category"message"
textstringMessage text content"Message for mentioned users, Hello <@uid:cometchat-uid-2>"
sentAtnumberUnix timestamp when sent1771495242
deliveredAtnumberUnix timestamp when delivered1771495244
readAtnumberUnix timestamp when read1771495244
updatedAtnumberUnix timestamp when updated1771495244
senderobjectSender user detailsSee below ↓
receiverobjectReceiver user detailsSee below ↓
dataobjectAdditional message dataSee below ↓
metadataobjectMessage metadataSee below ↓
reactionsarrayMessage reactions[]
mentionedUsersarrayUsers mentioned in messageSee below ↓
mentionedMebooleanWhether current user is mentionedtrue

lastMessage.mentionedUsers Array (per item):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"offline"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771738926
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0

lastMessage.sender Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771495034
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.receiver Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771494233
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.data Object:
ParameterTypeDescriptionSample Value
textstringMessage text"Message for mentioned users, Hello <@uid:cometchat-uid-2>"
resourcestringSDK resource identifier"REACT_NATIVE-4_0_14-..."
mentionsobjectMap of mentioned users by UIDSee below ↓
entitiesobjectSender and receiver entitiesSee below ↓
metadataobjectInjected metadataSee below ↓

lastMessage.data.mentions Object (keyed by UID):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771494233

lastMessage.data.entities Object:
ParameterTypeDescriptionSample Value
senderobjectSender entity wrapperSee below ↓
receiverobjectReceiver entity wrapperSee below ↓

lastMessage.data.entities.sender Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.sender.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771495034
tagsarrayUser tags[]

lastMessage.data.entities.receiver Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.receiver.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771494233
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"
tagsarrayUser tags[]

lastMessage.data.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.data.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.data.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.data.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

conversationWith Object (User):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771818451
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"

Set Tags

This method helps you fetch the conversations based on the specified tags.
let limit = 30;
let tags = ["archivedChat"];
let conversationRequest = new CometChat.ConversationsRequestBuilder()
  .setLimit(limit)
  .setTags(tags)
  .build(); 
On SuccessfetchNext() returns an array of Conversation objects filtered by conversation tags:Conversation Object (per item in array):
ParameterTypeDescriptionSample Value
conversationIdstringUnique conversation identifier"cometchat-uid-2_user_cometchat-uid-3"
conversationTypestringType of conversation"user"
unreadMentionsCountnumberCount of unread mentions0
lastReadMessageIdstringID of last read message"25276"
unreadMessageCountnumberCount of unread messages0
latestMessageIdstringID of latest message"25276"
lastMessageobjectLast message in conversationSee below ↓
conversationWithobjectUser detailsSee below ↓

lastMessage Object:
ParameterTypeDescriptionSample Value
idstringUnique message identifier"25276"
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"
receiverIdstringReceiver’s UID"cometchat-uid-2"
receiverTypestringType of receiver"user"
typestringMessage type"text"
categorystringMessage category"message"
textstringMessage text content"Message for mentioned users, Hello <@uid:cometchat-uid-2>"
sentAtnumberUnix timestamp when sent1771495242
deliveredAtnumberUnix timestamp when delivered1771495244
readAtnumberUnix timestamp when read1771495244
updatedAtnumberUnix timestamp when updated1771495244
senderobjectSender user detailsSee below ↓
receiverobjectReceiver user detailsSee below ↓
dataobjectAdditional message dataSee below ↓
metadataobjectMessage metadataSee below ↓
reactionsarrayMessage reactions[]
mentionedUsersarrayUsers mentioned in messageSee below ↓
mentionedMebooleanWhether current user is mentionedtrue

lastMessage.mentionedUsers Array (per item):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"offline"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771738926
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0

lastMessage.sender Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771495034
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.receiver Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771494233
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.data Object:
ParameterTypeDescriptionSample Value
textstringMessage text"Message for mentioned users, Hello <@uid:cometchat-uid-2>"
resourcestringSDK resource identifier"REACT_NATIVE-4_0_14-..."
mentionsobjectMap of mentioned users by UIDSee below ↓
entitiesobjectSender and receiver entitiesSee below ↓
metadataobjectInjected metadataSee below ↓

lastMessage.data.mentions Object (keyed by UID):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771494233

lastMessage.data.entities Object:
ParameterTypeDescriptionSample Value
senderobjectSender entity wrapperSee below ↓
receiverobjectReceiver entity wrapperSee below ↓

lastMessage.data.entities.sender Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.sender.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771495034
tagsarrayUser tags[]

lastMessage.data.entities.receiver Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.receiver.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771494233
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"
tagsarrayUser tags[]

lastMessage.data.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.data.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.data.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.data.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

conversationWith Object (User):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771818451
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"
Blocked Users in Conversations - Quick Reference
FlagEffect
setIncludeBlockedUsers(true)Includes blocked user conversations in results (hidden by default)
setWithBlockedInfo(true)Adds blockedByMe, hasBlockedMe, blockedByMeAt, blockedAt to conversationWith
Usage:
  • Use both together to see blocked conversations with accurate block status
  • conversationWith contains current block status
  • lastMessage.sender/receiver contains historical data from message time (may show false even if currently blocked)

Include Blocked Users

This method helps you fetch the conversations of users whom the logged-in user has blocked.
let limit = 30;
let conversationRequest = new CometChat.ConversationsRequestBuilder()
  .setLimit(limit)
  .setIncludeBlockedUsers(true)
  .build();
On SuccessfetchNext() returns an array of Conversation objects (includes conversations with blocked users):Conversation Object (per item in array):
ParameterTypeDescriptionSample Value
conversationIdstringUnique conversation identifier"cometchat-uid-2_user_cometchat-uid-3"
conversationTypestringType of conversation"user"
unreadMentionsCountnumberCount of unread mentions0
lastReadMessageIdstringID of last read message"25280"
unreadMessageCountnumberCount of unread messages0
latestMessageIdstringID of latest message"25276"
lastMessageobjectLast message in conversationSee below ↓
conversationWithobjectUser detailsSee below ↓

lastMessage Object:
ParameterTypeDescriptionSample Value
idstringUnique message identifier"25280"
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"
receiverIdstringReceiver’s UID"cometchat-uid-2"
receiverTypestringType of receiver"user"
typestringMessage type"text"
categorystringMessage category"message"
textstringMessage text content"Hello Blocker"
sentAtnumberUnix timestamp when sent1771820699
updatedAtnumberUnix timestamp when updated1771820699
senderobjectSender user detailsSee below ↓
receiverobjectReceiver user detailsSee below ↓
dataobjectAdditional message dataSee below ↓
metadataobjectMessage metadataSee below ↓
reactionsarrayMessage reactions[]
mentionedUsersarrayUsers mentioned in message[]
mentionedMebooleanWhether current user is mentionedfalse

lastMessage.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.sender Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771818451
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.receiver Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"offline"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771738926
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.data Object:
ParameterTypeDescriptionSample Value
textstringMessage text"Hello Blocker"
resourcestringSDK resource identifier"REACT_NATIVE-4_0_14-..."
entitiesobjectSender and receiver entitiesSee below ↓
metadataobjectInjected metadataSee below ↓
moderationobjectModeration status{"status": "approved"}

lastMessage.data.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.data.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.data.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.data.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.data.entities Object:
ParameterTypeDescriptionSample Value
senderobjectSender entity wrapperSee below ↓
receiverobjectReceiver entity wrapperSee below ↓

lastMessage.data.entities.sender Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectSender user detailsSee below ↓

lastMessage.data.entities.sender.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771818451
tagsarrayUser tags[]

lastMessage.data.entities.receiver Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectReceiver user details with block infoSee below ↓

lastMessage.data.entities.receiver.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
rolestringUser’s role"default"
statusstringUser’s online status"offline"
lastActiveAtnumberLast active timestamp1771738926
tagsarrayUser tags[]
hasBlockedMebooleanWhether user has blocked current userfalse
hasBlockedMeAtnumberTimestamp when blocked by user0
blockedAtnumberTimestamp when blocked0
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"

conversationWith Object (User):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"offline"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771738926
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"

With Blocked Info

This method can be used to fetch the blocked information of the blocked user in the ConversationWith object.
let limit = 30;
let conversationRequest = new CometChat.ConversationsRequestBuilder()
  .setLimit(limit)
  .setWithBlockedInfo(true)
  .build();
On SuccessfetchNext() returns an array of Conversation objects with blocked info in conversationWith:Conversation Object (per item in array):
ParameterTypeDescriptionSample Value
conversationIdstringUnique conversation identifier"cometchat-uid-2_user_cometchat-uid-3"
conversationTypestringType of conversation"user"
unreadMentionsCountnumberCount of unread mentions0
lastReadMessageIdstringID of last read message"25276"
unreadMessageCountnumberCount of unread messages0
latestMessageIdstringID of latest message"25276"
lastMessageobjectLast message in conversationSee below ↓
conversationWithobjectUser details with blocked infoSee below ↓

lastMessage Object:
ParameterTypeDescriptionSample Value
idstringUnique message identifier"25276"
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"
receiverIdstringReceiver’s UID"cometchat-uid-2"
receiverTypestringType of receiver"user"
typestringMessage type"text"
categorystringMessage category"message"
textstringMessage text content"Message for mentioned users, Hello <@uid:cometchat-uid-2>"
sentAtnumberUnix timestamp when sent1771495242
deliveredAtnumberUnix timestamp when delivered1771495244
readAtnumberUnix timestamp when read1771495244
updatedAtnumberUnix timestamp when updated1771495244
senderobjectSender user detailsSee below ↓
receiverobjectReceiver user detailsSee below ↓
dataobjectAdditional message dataSee below ↓
metadataobjectMessage metadataSee below ↓
reactionsarrayMessage reactions[]
mentionedUsersarrayUsers mentioned in messageSee below ↓
mentionedMebooleanWhether current user is mentionedtrue

lastMessage.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.mentionedUsers Array (per item):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"offline"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771738926
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0

lastMessage.sender Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771495034
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.receiver Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771494233
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.data Object:
ParameterTypeDescriptionSample Value
textstringMessage text"Message for mentioned users, Hello <@uid:cometchat-uid-2>"
resourcestringSDK resource identifier"REACT_NATIVE-4_0_14-..."
mentionsobjectMap of mentioned users by UIDSee below ↓
entitiesobjectSender and receiver entitiesSee below ↓
metadataobjectInjected metadataSee below ↓

lastMessage.data.mentions Object (keyed by UID):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771494233

lastMessage.data.entities Object:
ParameterTypeDescriptionSample Value
senderobjectSender entity wrapperSee below ↓
receiverobjectReceiver entity wrapperSee below ↓

lastMessage.data.entities.sender Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.sender.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771495034
tagsarrayUser tags[]

lastMessage.data.entities.receiver Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.receiver.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-2"
namestringUser’s display name"George Alan"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771494233
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"
tagsarrayUser tags[]

lastMessage.data.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.data.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.data.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.data.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

conversationWith Object (User with blocked info):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771818451
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this usertrue
deactivatedAtnumberDeactivation timestamp (0 if active)0
blockedByMeAtnumberTimestamp when blocked by current user1771820668
blockedAtnumberBlock timestamp1771820668
conversationIdstringConversation identifier"cometchat-uid-2_user_cometchat-uid-3"

Search Conversations

This method helps you search for a conversation based on a User or Group name.
This feature is only available with Conversation & Advanced Search. The Conversation & Advanced Search is only available in Advanced & Custom plans. If you’re already on one of these plans, please enable the Conversation & Advanced Search from CometChat Dashboard (Open your app, navigate to Chats -> Settings -> General Configuration)
let limit = 30;
let conversationRequest = new CometChat.ConversationsRequestBuilder()
  .setLimit(limit)
  .setSearchKeyword("Hiking")
  .build();
On SuccessfetchNext() returns an array of Conversation objects matching the search keyword:Conversation Object (per item in array):
ParameterTypeDescriptionSample Value
conversationIdstringUnique conversation identifier"group_cometchat-guid-1"
conversationTypestringType of conversation"group"
unreadMentionsCountnumberCount of unread mentions0
lastReadMessageIdstringID of last read message"4791"
unreadMessageCountnumberCount of unread messages0
latestMessageIdstringID of latest message"4791"
lastMessageobjectLast message in conversationSee below ↓
conversationWithobjectGroup detailsSee below ↓

lastMessage Object (Action Message):
ParameterTypeDescriptionSample Value
idstringUnique message identifier"4791"
conversationIdstringConversation identifier"group_cometchat-guid-1"
receiverIdstringGroup’s GUID"cometchat-guid-1"
receiverTypestringType of receiver"group"
typestringMessage type"groupMember"
categorystringMessage category"action"
actionstringAction performed"kicked"
messagestringAction message text"John Paul kicked Andrew Joseph"
sentAtnumberUnix timestamp when sent1753946954
deliveredAtnumberUnix timestamp when delivered1764150385
updatedAtnumberUnix timestamp when updated1764150385
actionByobjectUser who performed actionSee below ↓
actionForobjectGroup the action was forSee below ↓
actionOnobjectUser the action was onSee below ↓
senderobjectSender user detailsSame as actionBy
receiverobjectReceiver group detailsSame as actionFor
dataobjectAdditional message dataSee below ↓
reactionsarrayMessage reactions[]
mentionedUsersarrayUsers mentioned in message[]
mentionedMebooleanWhether current user is mentionedfalse

lastMessage.actionBy Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-5"
namestringUser’s display name"John Paul"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-5.webp"
statusstringUser’s online status"offline"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1753945410
createdAtnumberUser creation timestamp1746375164
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0

lastMessage.actionFor Object (Group):
ParameterTypeDescriptionSample Value
guidstringGroup’s unique identifier"cometchat-guid-1"
namestringGroup’s display name"Hiking Group"
typestringGroup type"private"
descriptionstringGroup description"Explore, connect, and chat with fellow outdoor enthusiasts..."
iconstringURL to group icon"https://assets.cometchat.io/sampleapp/v2/groups/cometchat-guid-1.webp"
conversationIdstringConversation identifier"group_cometchat-guid-1"
ownerstringGroup owner’s UID"cometchat-uid-5"
membersCountnumberTotal members in group3
hasJoinedbooleanWhether current user has joinedfalse
isBannedbooleanWhether current user is bannedfalse
createdAtnumberGroup creation timestamp1746375164
updatedAtnumberGroup update timestamp1753945144

lastMessage.actionOn Object (User):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-1"
namestringUser’s display name"Andrew Joseph"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-1.webp"
statusstringUser’s online status"offline"
statusMessagestringUser’s status message"Hey there I'm using CometChat"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1753944766
conversationIdstringConversation identifier"cometchat-uid-1_user_cometchat-uid-5"
createdAtnumberUser creation timestamp1746375164
updatedAtnumberUser update timestamp1749731589
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0

lastMessage.data Object:
ParameterTypeDescriptionSample Value
actionstringAction type"kicked"
entitiesobjectAction entitiesSee below ↓

lastMessage.data.entities Object:
ParameterTypeDescriptionSample Value
byobjectUser who performed actionSee below ↓
forobjectGroup the action was forSee below ↓
onobjectUser the action was onSee below ↓

lastMessage.data.entities.by Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.by.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-5"
namestringUser’s display name"John Paul"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-5.webp"
rolestringUser’s role"default"
statusstringUser’s online status"offline"
lastActiveAtnumberLast active timestamp1753945410
createdAtnumberUser creation timestamp1746375164

lastMessage.data.entities.for Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"group"
entityobjectGroup entity detailsSee below ↓

lastMessage.data.entities.for.entity Object:
ParameterTypeDescriptionSample Value
guidstringGroup’s unique identifier"cometchat-guid-1"
namestringGroup’s display name"Hiking Group"
typestringGroup type"private"
descriptionstringGroup description"Explore, connect, and chat with fellow outdoor enthusiasts..."
iconstringURL to group icon"https://assets.cometchat.io/sampleapp/v2/groups/cometchat-guid-1.webp"
conversationIdstringConversation identifier"group_cometchat-guid-1"
ownerstringGroup owner’s UID"cometchat-uid-5"
membersCountnumberTotal members in group3
hasJoinedbooleanWhether current user has joinedfalse
isBannedbooleanWhether current user is bannedfalse
createdAtnumberGroup creation timestamp1746375164
updatedAtnumberGroup update timestamp1753945144

lastMessage.data.entities.on Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.on.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-1"
namestringUser’s display name"Andrew Joseph"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-1.webp"
rolestringUser’s role"default"
statusstringUser’s online status"offline"
statusMessagestringUser’s status message"Hey there I'm using CometChat"
lastActiveAtnumberLast active timestamp1753944766
conversationIdstringConversation identifier"cometchat-uid-1_user_cometchat-uid-5"
createdAtnumberUser creation timestamp1746375164
updatedAtnumberUser update timestamp1749731589

conversationWith Object (Group):
ParameterTypeDescriptionSample Value
guidstringGroup’s unique identifier"cometchat-guid-1"
namestringGroup’s display name"Hiking Group"
typestringGroup type"private"
descriptionstringGroup description"Explore, connect, and chat with fellow outdoor enthusiasts..."
iconstringURL to group icon"https://assets.cometchat.io/sampleapp/v2/groups/cometchat-guid-1.webp"
conversationIdstringConversation identifier"group_cometchat-guid-1"
ownerstringGroup owner’s UID"cometchat-uid-5"
scopestringCurrent user’s scope in group"participant"
membersCountnumberTotal members in group3
onlineMembersCountnumberOnline members count1
hasJoinedbooleanWhether current user has joinedtrue
isBannedbooleanWhether current user is bannedfalse
joinedAtnumberTimestamp when user joined1746375164
createdAtnumberGroup creation timestamp1746375164
updatedAtnumberGroup update timestamp1753946955

Unread Conversations

This method helps you fetch unread conversations.
This feature is only available with Conversation & Advanced Search. The Conversation & Advanced Search is only available in Advanced & Custom plans. If you’re already on one of these plans, please enable the Conversation & Advanced Search from CometChat Dashboard (Open your app, navigate to Chats -> Settings -> General Configuration)
let limit = 30;
let conversationRequest = new CometChat.ConversationsRequestBuilder()
  .setLimit(limit)
  .setUnread(true)
  .build();
On SuccessfetchNext() returns an array of Conversation objects with unread messages:Conversation Object (per item in array):
ParameterTypeDescriptionSample Value
conversationIdstringUnique conversation identifier"group_group_1762515421478"
conversationTypestringType of conversation"group"
unreadMentionsCountnumberCount of unread mentions0
lastReadMessageIdstringID of last read message"24359"
unreadMessageCountnumberCount of unread messages2
latestMessageIdstringID of latest message"25236"
lastMessageobjectLast message in conversationSee below ↓
conversationWithobjectGroup detailsSee below ↓

lastMessage Object:
ParameterTypeDescriptionSample Value
idstringUnique message identifier"25236"
conversationIdstringConversation identifier"group_group_1762515421478"
receiverIdstringGroup’s GUID"group_1762515421478"
receiverTypestringType of receiver"group"
typestringMessage type"text"
categorystringMessage category"message"
textstringMessage text content"Hru"
sentAtnumberUnix timestamp when sent1771400675
updatedAtnumberUnix timestamp when updated1771400675
senderobjectSender user detailsSee below ↓
receiverobjectReceiver group detailsSee below ↓
dataobjectAdditional message dataSee below ↓
metadataobjectMessage metadataSee below ↓
reactionsarrayMessage reactions[]
mentionedUsersarrayUsers mentioned in message[]
mentionedMebooleanWhether current user is mentionedfalse

lastMessage.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.sender Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771397739
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.receiver Object (Group):
ParameterTypeDescriptionSample Value
guidstringGroup’s unique identifier"group_1762515421478"
namestringGroup’s display name"TwoMemberGroup"
typestringGroup type"public"
conversationIdstringConversation identifier"group_group_1762515421478"
ownerstringGroup owner’s UID"cometchat-uid-2"
scopestringCurrent user’s scope in group"participant"
membersCountnumberTotal members in group3
onlineMembersCountnumberOnline members count2
hasJoinedbooleanWhether current user has joinedtrue
isBannedbooleanWhether current user is bannedfalse
joinedAtnumberTimestamp when user joined1762515534
createdAtnumberGroup creation timestamp1762515421
updatedAtnumberGroup update timestamp1768888876

lastMessage.data Object:
ParameterTypeDescriptionSample Value
textstringMessage text"Hru"
resourcestringSDK resource identifier"REACT_NATIVE-4_0_14-..."
entitiesobjectSender and receiver entitiesSee below ↓
metadataobjectInjected metadataSee below ↓

lastMessage.data.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.data.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.data.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.data.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.data.entities Object:
ParameterTypeDescriptionSample Value
senderobjectSender entity wrapperSee below ↓
receiverobjectReceiver entity wrapperSee below ↓

lastMessage.data.entities.sender Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.sender.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-3"
namestringUser’s display name"Nancy Grace"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-3.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771397739
tagsarrayUser tags[]

lastMessage.data.entities.receiver Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"group"
entityobjectGroup entity detailsSee below ↓

lastMessage.data.entities.receiver.entity Object:
ParameterTypeDescriptionSample Value
guidstringGroup’s unique identifier"group_1762515421478"
namestringGroup’s display name"TwoMemberGroup"
typestringGroup type"public"
conversationIdstringConversation identifier"group_group_1762515421478"
ownerstringGroup owner’s UID"cometchat-uid-2"
scopestringCurrent user’s scope in group"participant"
membersCountnumberTotal members in group3
onlineMembersCountnumberOnline members count2
hasJoinedbooleanWhether current user has joinedtrue
joinedAtnumberTimestamp when user joined1762515534
createdAtnumberGroup creation timestamp1762515421
updatedAtnumberGroup update timestamp1768888876

conversationWith Object (Group):
ParameterTypeDescriptionSample Value
guidstringGroup’s unique identifier"group_1762515421478"
namestringGroup’s display name"TwoMemberGroup"
typestringGroup type"public"
conversationIdstringConversation identifier"group_group_1762515421478"
ownerstringGroup owner’s UID"cometchat-uid-2"
scopestringCurrent user’s scope in group"admin"
membersCountnumberTotal members in group3
onlineMembersCountnumberOnline members count1
hasJoinedbooleanWhether current user has joinedtrue
isBannedbooleanWhether current user is bannedfalse
joinedAtnumberTimestamp when user joined1762515421
createdAtnumberGroup creation timestamp1762515421
updatedAtnumberGroup update timestamp1768888876
Finally, once all the parameters are set to the builder class, you need to call the build() method to get the object of the ConversationsRequest class. Once you have the object of the ConversationsRequest class, you need to call the fetchNext() method. Calling this method will return a list of Conversation objects containing X number of users depending on the limit set. A Maximum of only 50 Conversations can be fetched at once.
let limit = 30;
let conversationsRequest = new CometChat.ConversationsRequestBuilder()
  .setLimit(limit)
  .build();

conversationsRequest.fetchNext().then(
  conversationList => {
    console.log("Conversations list received:", conversationList);
  }, error => {
    console.log("Conversations list fetching failed with error:", error);
  }
);
The Conversation Object consists of the following fields:
FieldInformation
conversationIdID of the conversation.
conversationTypeType of conversation. (user/group)
lastMessageLast message in the conversation.
conversationWithUser or Group object containing the details of the user or group.
unreadMessageCountUnread message count for the conversation.

Tag Conversation

In other words, as a logged-in user, how do I tag a conversation? To tag a specific conversation, you can use the tagConversation() method. The tagConversation() method accepts three parameters.
  1. conversationWith: UID/GUID of the user/group whose conversation you want to tag.
  2. conversationType: The conversationType variable can hold one of the below two values:
    1. user - Only fetches user conversation.
    2. group - Only fetches group conversations.
  3. tags: The tags variable will be a list of tags you want to add to a conversation.
let tags = ["archivedChat"];
CometChat.tagConversation('conversationWith', 'conversationType', tags).then(
  conversation => {
    console.log('conversation', conversation);
  }, error => {
    console.log('error while fetching a conversation', error);
  }
);
On SuccesstagConversation() returns the updated Conversation object with the new tags:Conversation Object:
ParameterTypeDescriptionSample Value
conversationIdstringUnique conversation identifier"cometchat-uid-6_user_cometchat-uid-7"
conversationTypestringType of conversation"user"
unreadMentionsCountnumberCount of unread mentions0
lastReadMessageIdstringID of last read message"25291"
unreadMessageCountnumberCount of unread messages0
latestMessageIdstringID of latest message"25291"
tagsarrayConversation tags["archivedChat"]
lastMessageobjectLast message in conversationSee below ↓
conversationWithobjectUser detailsSee below ↓

lastMessage Object:
ParameterTypeDescriptionSample Value
idstringUnique message identifier"25291"
conversationIdstringConversation identifier"cometchat-uid-6_user_cometchat-uid-7"
receiverIdstringReceiver’s UID"cometchat-uid-6"
receiverTypestringType of receiver"user"
typestringMessage type"text"
categorystringMessage category"message"
textstringMessage text content"Hello"
sentAtnumberUnix timestamp when sent1771831336
deliveredAtnumberUnix timestamp when delivered1771832977
readAtnumberUnix timestamp when read1771832977
updatedAtnumberUnix timestamp when updated1771832977
senderobjectSender user detailsSee below ↓
receiverobjectReceiver user detailsSee below ↓
dataobjectAdditional message dataSee below ↓
metadataobjectMessage metadataSee below ↓
reactionsarrayMessage reactions[]
mentionedUsersarrayUsers mentioned in message[]
mentionedMebooleanWhether current user is mentionedfalse

lastMessage.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.sender Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-7"
namestringUser’s display name"Henry Marino"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-7.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771829868
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.receiver Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-6"
namestringUser’s display name"Ronald Jerry"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-6.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771829859
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.data Object:
ParameterTypeDescriptionSample Value
textstringMessage text"Hello"
resourcestringSDK resource identifier"REACT_NATIVE-4_0_14-..."
entitiesobjectSender and receiver entitiesSee below ↓
metadataobjectInjected metadataSee below ↓

lastMessage.data.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.data.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.data.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.data.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.data.entities Object:
ParameterTypeDescriptionSample Value
senderobjectSender entity wrapperSee below ↓
receiverobjectReceiver entity wrapperSee below ↓

lastMessage.data.entities.sender Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.sender.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-7"
namestringUser’s display name"Henry Marino"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-7.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771829868
tagsarrayUser tags[]

lastMessage.data.entities.receiver Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.receiver.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-6"
namestringUser’s display name"Ronald Jerry"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-6.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771829859
conversationIdstringConversation identifier"cometchat-uid-6_user_cometchat-uid-7"
tagsarrayUser tags[]

conversationWith Object (User):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-7"
namestringUser’s display name"Henry Marino"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-7.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771834604
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
conversationIdstringConversation identifier"cometchat-uid-6_user_cometchat-uid-7"
The tags for conversations are one-way. This means that if user A tags a conversation with user B, that tag will be applied to that conversation only for user A.

Retrieve Single Conversation

In other words, as a logged-in user, how do I retrieve a specific conversation? To fetch a specific conversation, you can use the getConversation method. The getConversation method accepts two parameters.
  1. conversationWith: UID/GUID of the user/group whose conversation you want to fetch.
  2. conversationType: The conversationType variable can hold one of the below two values:
  • user - Only fetches user conversation.
  • group - Only fetches group conversations.
CometChat.getConversation('conversationWith', 'conversationType').then(
  conversation => {
    console.log('conversation', conversation);
  }, error => {
    console.log('error while fetching a conversation', error);
  }
);  
On SuccessgetConversation() returns the Conversation object:Conversation Object:
ParameterTypeDescriptionSample Value
conversationIdstringUnique conversation identifier"cometchat-uid-6_user_cometchat-uid-7"
conversationTypestringType of conversation"user"
unreadMentionsCountnumberCount of unread mentions0
lastReadMessageIdstringID of last read message"25291"
unreadMessageCountnumberCount of unread messages0
latestMessageIdstringID of latest message"25291"
tagsarrayConversation tags["archivedChat"]
lastMessageobjectLast message in conversationSee below ↓
conversationWithobjectUser detailsSee below ↓

lastMessage Object:
ParameterTypeDescriptionSample Value
idstringUnique message identifier"25291"
conversationIdstringConversation identifier"cometchat-uid-6_user_cometchat-uid-7"
receiverIdstringReceiver’s UID"cometchat-uid-6"
receiverTypestringType of receiver"user"
typestringMessage type"text"
categorystringMessage category"message"
textstringMessage text content"Hello"
sentAtnumberUnix timestamp when sent1771831336
deliveredAtnumberUnix timestamp when delivered1771832977
readAtnumberUnix timestamp when read1771832977
updatedAtnumberUnix timestamp when updated1771832977
senderobjectSender user detailsSee below ↓
receiverobjectReceiver user detailsSee below ↓
dataobjectAdditional message dataSee below ↓
metadataobjectMessage metadataSee below ↓
reactionsarrayMessage reactions[]
mentionedUsersarrayUsers mentioned in message[]
mentionedMebooleanWhether current user is mentionedfalse

lastMessage.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.sender Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-7"
namestringUser’s display name"Henry Marino"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-7.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771829868
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.receiver Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-6"
namestringUser’s display name"Ronald Jerry"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-6.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771829859
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.data Object:
ParameterTypeDescriptionSample Value
textstringMessage text"Hello"
resourcestringSDK resource identifier"REACT_NATIVE-4_0_14-..."
entitiesobjectSender and receiver entitiesSee below ↓
metadataobjectInjected metadataSee below ↓

lastMessage.data.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.data.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.data.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.data.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.data.entities Object:
ParameterTypeDescriptionSample Value
senderobjectSender entity wrapperSee below ↓
receiverobjectReceiver entity wrapperSee below ↓

lastMessage.data.entities.sender Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.sender.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-7"
namestringUser’s display name"Henry Marino"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-7.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771829868
tagsarrayUser tags[]

lastMessage.data.entities.receiver Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.receiver.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-6"
namestringUser’s display name"Ronald Jerry"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-6.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771829859
conversationIdstringConversation identifier"cometchat-uid-6_user_cometchat-uid-7"
tagsarrayUser tags[]

conversationWith Object (User):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-7"
namestringUser’s display name"Henry Marino"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-7.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771834604
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]
conversationIdstringConversation identifier"cometchat-uid-6_user_cometchat-uid-7"

Convert Messages to Conversations

As per our receive messages guide, for real-time messages, you will always receive Message objects and not Conversation objects. Thus, you will need a mechanism to convert the Message object to a Conversation object. You can use the getConversationFromMessage(BaseMessage message) method of the CometChatHelper class.
CometChat.CometChatHelper.getConversationFromMessage(message).then(
conversation => {
  console.log("Conversation Object", conversation);
}, error => {
  console.log("Error while converting message object", error);
}
);
On SuccessgetConversationFromMessage() returns the converted Conversation object:Conversation Object:
ParameterTypeDescriptionSample Value
conversationIdstringUnique conversation identifier"cometchat-uid-6_user_cometchat-uid-7"
conversationTypestringType of conversation"user"
unreadMentionsCountnumberCount of unread mentions0
lastReadMessageIdstringID of last read message (empty when converted)""
unreadMessageCountnumberCount of unread messages (0 when converted)0
latestMessageIdstringID of latest message (empty when converted)""
lastMessageobjectThe source message converted to lastMessageSee below ↓
conversationWithobjectUser details from message receiverSee below ↓

lastMessage Object:
ParameterTypeDescriptionSample Value
idstringUnique message identifier"25291"
conversationIdstringConversation identifier"cometchat-uid-6_user_cometchat-uid-7"
receiverIdstringReceiver’s UID"cometchat-uid-6"
receiverTypestringType of receiver"user"
typestringMessage type"text"
categorystringMessage category"message"
textstringMessage text content"Hello"
sentAtnumberUnix timestamp when sent1771831336
deliveredAtnumberUnix timestamp when delivered1771832977
readAtnumberUnix timestamp when read1771832977
updatedAtnumberUnix timestamp when updated1771832977
senderobjectSender user detailsSee below ↓
receiverobjectReceiver user detailsSee below ↓
dataobjectAdditional message dataSee below ↓
metadataobjectMessage metadataSee below ↓
reactionsarrayMessage reactions[]
mentionedUsersarrayUsers mentioned in message[]
mentionedMebooleanWhether current user is mentionedfalse

lastMessage.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.sender Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-7"
namestringUser’s display name"Henry Marino"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-7.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771829868
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.receiver Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-6"
namestringUser’s display name"Ronald Jerry"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-6.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771829859
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]

lastMessage.data Object:
ParameterTypeDescriptionSample Value
textstringMessage text"Hello"
resourcestringSDK resource identifier"REACT_NATIVE-4_0_14-..."
entitiesobjectSender and receiver entitiesSee below ↓
metadataobjectInjected metadataSee below ↓

lastMessage.data.metadata Object:
ParameterTypeDescriptionSample Value
@injectedobjectInjected extensions dataSee below ↓

lastMessage.data.metadata.@injected Object:
ParameterTypeDescriptionSample Value
extensionsobjectExtensions dataSee below ↓

lastMessage.data.metadata.@injected.extensions Object:
ParameterTypeDescriptionSample Value
link-previewobjectLink preview extensionSee below ↓

lastMessage.data.metadata.@injected.extensions.link-preview Object:
ParameterTypeDescriptionSample Value
linksarrayExtracted links[]

lastMessage.data.entities Object:
ParameterTypeDescriptionSample Value
senderobjectSender entity wrapperSee below ↓
receiverobjectReceiver entity wrapperSee below ↓

lastMessage.data.entities.sender Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.sender.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-7"
namestringUser’s display name"Henry Marino"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-7.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771829868
tagsarrayUser tags[]

lastMessage.data.entities.receiver Object:
ParameterTypeDescriptionSample Value
entityTypestringType of entity"user"
entityobjectUser entity detailsSee below ↓

lastMessage.data.entities.receiver.entity Object:
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-6"
namestringUser’s display name"Ronald Jerry"
avatarstringUser’s avatar URL"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-6.webp"
rolestringUser’s role"default"
statusstringUser’s online status"online"
lastActiveAtnumberLast active timestamp1771829859
conversationIdstringConversation identifier"cometchat-uid-6_user_cometchat-uid-7"
tagsarrayUser tags[]

conversationWith Object (User):
ParameterTypeDescriptionSample Value
uidstringUser’s unique identifier"cometchat-uid-7"
namestringUser’s display name"Henry Marino"
avatarstringURL to user’s avatar"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-7.webp"
statusstringUser’s online status"online"
rolestringUser’s role"default"
lastActiveAtnumberLast active timestamp1771829868
hasBlockedMebooleanWhether user has blocked current userfalse
blockedByMebooleanWhether current user blocked this userfalse
deactivatedAtnumberDeactivation timestamp (0 if active)0
tagsarrayUser tags[]
While converting the Message object to the Conversation object, the unreadMessageCount & tags will not be available in the Conversation object. The unread message count needs to be managed in your client-side code.

Best Practices & Troubleshooting

Always use fetchNext() in a loop or on-scroll handler to paginate through conversations. Fetching all conversations at once is not supported — the maximum per request is 50. Store the ConversationsRequest object and call fetchNext() repeatedly until it returns an empty list.
Use real-time message listeners to receive new messages, then call CometChatHelper.getConversationFromMessage() to convert incoming messages into Conversation objects and update your list. Note that unreadMessageCount and tags are not available when converting from a message — manage those on the client side.
Use setTags() to categorize conversations (e.g., archivedChat, pinned). Remember that conversation tags are one-way — tagging a conversation only applies for the logged-in user, not the other participant.
Ensure the logged-in user has actually exchanged messages with the expected users or groups. Conversations only appear once at least one message has been sent. Also verify that any filters (conversation type, tags, unread) are not excluding the results you expect.
The setSearchKeyword() and setUnread() methods require the Conversation & Advanced Search feature, which is only available on Advanced and Custom plans. Enable it from the CometChat Dashboard under Chats → Settings → General Configuration.

Next Steps