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: a. CometChat.conversationType.user(user) - Only fetches user conversation. b. CometChat.conversationType.group(group)- Only fetches group conversations.
If none is set, the list of conversations will include both user and group conversations.
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 users depending on the limit set.
Conversation
object consists of the below fields:
Field | Information |
---|---|
conversationId | id of the conversation |
conversationType | type of conversation (user/group) |
lastMessage | last message in the conversation |
conversationWith | User or Group object containing the details |
unreadMessageCount | unread message count for the conversation |
unreadMentionsCount | count of unread mentions in the conversation |
lastReadMessageId | ID of the last read message in 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:Conversation
object. You can use the getConversationFromMessage(BaseMessage message)
of the CometChatHelper
class.
Message
object to a Conversation
object, the unreadMessageCount
will not be available in the Conversation
object. As this is for real-time events, the unread message count needs to be managed in your client-side code.