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:
conversationType
variable can hold one of the below two values:
Conversation
Object. By default the value is false.
false
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)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)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 conversations depending on the limit set.
A Maximum of only 50 Conversations can be fetched at once.
Conversation
object consists of the following fields:
Field | Information |
---|---|
conversationId | ID of the conversation |
conversationType | Type of conversation (user/group) |
lastMessage | Last message the conversation |
conversationWith | User or Group object containing the details of the user or group |
unreadMessageCount | Unread message count for the conversation |
tagConversation()
method. The tagConversation()
method accepts three parameters.
conversationWith
: UID/GUID of the user/group whose conversation you want to fetch.
conversationType
: The conversationType
variable can hold one of the below two values:
tags
: The tags
variable will be a list of tags you want to add to a conversation.
getConversation
method. The getConversation
method accepts two parameters.
conversationWith
: UID/GUID of the user/group whose conversation you want to fetch.conversationType
: The conversationType
variable can hold one of the below two values: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
method for this purpose.
Message
object to a 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.