Skip to content

Commit dc39b54

Browse files
Update retrieve-conversations.mdx
1 parent 7a4e47c commit dc39b54

1 file changed

Lines changed: 1 addition & 214 deletions

File tree

sdk/javascript/retrieve-conversations.mdx

Lines changed: 1 addition & 214 deletions
Original file line numberDiff line numberDiff line change
@@ -97,31 +97,6 @@ Relevant fields to access on returned conversations:
9797

9898
### With User and Group Tags
9999

100-
This method can be used to fetch the user/group tags in the `Conversation` Object. By default the value is `false`.
101-
102-
<Tabs>
103-
<Tab title="JavaScript">
104-
```javascript
105-
let limit = 30;
106-
let conversationType = "group";
107-
let conversationRequest = new CometChat.ConversationsRequestBuilder()
108-
.setLimit(limit)
109-
.setConversationType(conversationType)
110-
.build();
111-
```
112-
113-
</Tab>
114-
115-
</Tabs>
116-
117-
<Note>
118-
Default limit is 30, maximum is 50.
119-
</Note>
120-
121-
When conversations are fetched successfully, the response includes an array of [`Conversation`](/sdk/reference/entities#conversation) objects filtered by the specified type.
122-
123-
### With User and Group Tags
124-
125100
Use `withUserAndGroupTags(true)` to include user/group tags in the response. Default is `false`.
126101

127102
<Tabs>
@@ -148,26 +123,6 @@ Relevant fields to access on returned conversations:
148123

149124
### Set User Tags
150125

151-
This method fetches user conversations that have the specified tags.
152-
153-
<Tabs>
154-
<Tab title="JavaScript">
155-
```javascript
156-
let limit = 30;
157-
let conversationRequest = new CometChat.ConversationsRequestBuilder()
158-
.setLimit(limit)
159-
.withUserAndGroupTags(true)
160-
.build();
161-
```
162-
163-
</Tab>
164-
165-
</Tabs>
166-
167-
When conversations are fetched successfully, the response includes `tags` arrays on the `conversationWith` objects.
168-
169-
### Set User Tags
170-
171126
Fetch user conversations where the user has specific tags.
172127

173128
<Tabs>
@@ -195,27 +150,6 @@ Relevant fields to access on returned conversations:
195150

196151
### Set Group Tags
197152

198-
This method fetches group conversations that have the specified tags.
199-
200-
<Tabs>
201-
<Tab title="JavaScript">
202-
```javascript
203-
let limit = 30;
204-
let userTags = ["tag1"];
205-
let conversationRequest = new CometChat.ConversationsRequestBuilder()
206-
.setLimit(limit)
207-
.setUserTags(userTags)
208-
.build();
209-
```
210-
211-
</Tab>
212-
213-
</Tabs>
214-
215-
When conversations are fetched successfully, the response includes only user conversations where the user has the specified tags.
216-
217-
### Set Group Tags
218-
219153
Fetch group conversations where the group has specific tags.
220154

221155
<Tabs>
@@ -243,27 +177,6 @@ Relevant fields to access on returned conversations:
243177

244178
### With Tags
245179

246-
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`
247-
248-
<Tabs>
249-
<Tab title="JavaScript">
250-
```javascript
251-
let limit = 30;
252-
let groupTags = ["tag1"];
253-
let conversationRequest = new CometChat.ConversationsRequestBuilder()
254-
.setLimit(limit)
255-
.setGroupTags(groupTags)
256-
.build();
257-
```
258-
259-
</Tab>
260-
261-
</Tabs>
262-
263-
When conversations are fetched successfully, the response includes only group conversations where the group has the specified tags.
264-
265-
### With Tags
266-
267180
Use `withTags(true)` to include conversation tags in the response. Default is `false`.
268181

269182
<Tabs>
@@ -288,23 +201,6 @@ Relevant fields to access on returned conversations:
288201

289202
### Set Tags
290203

291-
This method helps you fetch the conversations based on the specified tags.
292-
293-
<Tabs>
294-
<Tab title="JavaScript">
295-
```javascript
296-
let limit = 30;
297-
let conversationRequest = new CometChat.ConversationsRequestBuilder()
298-
.setLimit(limit)
299-
.withTags(true)
300-
.build();
301-
```
302-
303-
</Tab>
304-
305-
</Tabs>
306-
### Set Tags
307-
308204
Fetch conversations that have specific tags.
309205

310206
<Tabs>
@@ -330,24 +226,6 @@ Relevant fields to access on returned conversations:
330226

331227
### Include Blocked Users
332228

333-
This method helps you fetch the conversations of users whom the logged-in user has blocked.
334-
335-
<Tabs>
336-
<Tab title="JavaScript">
337-
```javascript
338-
let limit = 30;
339-
let tags = ["archivedChat"];
340-
let conversationRequest = new CometChat.ConversationsRequestBuilder()
341-
.setLimit(limit)
342-
.setTags(tags)
343-
.build();
344-
```
345-
346-
</Tab>
347-
348-
</Tabs>
349-
### Include Blocked Users
350-
351229
Use `setIncludeBlockedUsers(true)` to include conversations with users you've blocked.
352230

353231
<Tabs>
@@ -517,6 +395,7 @@ let conversationRequest = new CometChat.ConversationsRequestBuilder()
517395
</Tab>
518396

519397
</Tabs>
398+
520399
### Only Agentic Conversations
521400

522401
Use `setOnlyAgentic(true)` to fetch only AI agent conversations.
@@ -542,31 +421,6 @@ The `setHideAgentic()` and `setOnlyAgentic()` methods are mutually exclusive. Yo
542421
</Note>
543422

544423
When conversations are fetched successfully, the response will include only conversations with AI agents. Agent users have `role: "@agentic"` and include agent-specific metadata.
545-
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.
546-
547-
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`](/sdk/reference/entities#conversation) objects containing X number of users depending on the limit set.
548-
549-
A Maximum of only 50 Conversations can be fetched at once.
550-
551-
<Tabs>
552-
<Tab title="JavaScript">
553-
```javascript
554-
let limit = 30;
555-
let conversationRequest = new CometChat.ConversationsRequestBuilder()
556-
.setLimit(limit)
557-
.setOnlyAgentic(true)
558-
.build();
559-
```
560-
561-
</Tab>
562-
563-
</Tabs>
564-
565-
<Note>
566-
`setHideAgentic()` and `setOnlyAgentic()` are mutually exclusive — use only one per request.
567-
</Note>
568-
569-
When conversations are fetched successfully, the response includes only AI agent conversations. Agent users have `role: "@agentic"`.
570424

571425
### Fetch Conversations
572426

@@ -664,47 +518,6 @@ Relevant fields to access on returned conversation:
664518

665519
## Retrieve Single Conversation
666520

667-
*In other words, as a logged-in user, how do I retrieve a specific conversation?*
668-
669-
To fetch a specific conversation, you can use the `getConversation` method. The `getConversation` method accepts two parameters.
670-
671-
1. `conversationWith`: UID/GUID of the user/group whose conversation you want to fetch.
672-
673-
2. `conversationType`: The `conversationType` variable can hold one of the below two values:
674-
675-
1. user - Only fetches user conversation.
676-
2. group - Only fetches group conversations.
677-
678-
<Tabs>
679-
<Tab title="JavaScript">
680-
```javascript
681-
let tags = ["archivedChat"];
682-
683-
let conversationWith = "UID";
684-
let conversationType = "user";
685-
686-
CometChat.tagConversation(conversationWith, conversationType, tags).then(
687-
(conversation) => {
688-
console.log("conversation", conversation);
689-
},
690-
(error) => {
691-
console.log("error while fetching a conversation", error);
692-
}
693-
);
694-
```
695-
696-
</Tab>
697-
698-
</Tabs>
699-
700-
<Note>
701-
Conversation tags are one-way. If user A tags a conversation with user B, that tag only applies for user A.
702-
</Note>
703-
704-
When the conversation is tagged successfully, the response returns a [`Conversation`](/sdk/reference/entities#conversation) object with the `tags` field.
705-
706-
## Retrieve Single Conversation
707-
708521
Use `getConversation()` to fetch a specific conversation.
709522

710523
| Parameter | Description |
@@ -738,32 +551,6 @@ The `getConversation()` method returns a single [`Conversation`](/sdk/reference/
738551

739552
## Convert Messages to Conversations
740553

741-
As per our [receive messages](/sdk/javascript/receive-message) guide, for real-time messages, you will always receive `Message` objects and not [`Conversation`](/sdk/reference/entities#conversation) objects. Thus, you will need a mechanism to convert the Message object to the `Conversation` object. You can use the `getConversationFromMessage(BaseMessage message)` of the `CometChatHelper` class.
742-
743-
<Tabs>
744-
<Tab title="JavaScript">
745-
```javascript
746-
let conversationWith = "UID";
747-
let conversationType = "user";
748-
749-
CometChat.getConversation(conversationWith, conversationType).then(
750-
(conversation) => {
751-
console.log("conversation", conversation);
752-
},
753-
(error) => {
754-
console.log("error while fetching a conversation", error);
755-
}
756-
);
757-
```
758-
759-
</Tab>
760-
761-
</Tabs>
762-
763-
When the conversation is fetched successfully, the response returns a single [`Conversation`](/sdk/reference/entities#conversation) object.
764-
765-
## Convert Messages to Conversations
766-
767554
Use `CometChatHelper.getConversationFromMessage()` to convert a received message into a [`Conversation`](/sdk/reference/entities#conversation) object. Useful for updating your Recent Chats list when receiving real-time messages.
768555

769556
<Tabs>

0 commit comments

Comments
 (0)