Skip to main content

Search Conversation in Chatroom

Search Conversation

Searching a conversation allows you to find specific conversations based on a search term, follow status, chatroom, and pagination details.

Steps to Search a Conversation

  1. Create an object of the ConversationSearchRequest class using the ConversationSearchRequestBuilder class.
  2. Call the searchConversation() method from the LMChatClient class using your request object.
  3. Process the response LMResponse<ConversationSearchResponse> as per your requirement.
ConversationSearchRequest request = (ConversationSearchRequestBuilder()
..searchTerm("ENTER_SEARCH_TERM")
..followStatus(true) // or false
..page(1)
..pageSize(10)
..chatroomId(ENTER_CHATROOM_ID))
.build();

LMResponse<ConversationSearchResponse> response = await lmChatClient.searchConversation(request);

if (response.success) {
// your function to process the response data
processResponse(response);
} else {
// your function to process error message
processError(response.errorMessage);
}

Models

ConversationSearchRequest

List of parameters for the ConversationSearchRequest class.

VariableTypeDescriptionOptional
searchTermStringKeyword for searching conversations
followStatusboolFilter by follow status (true or false)
pageintPage number for paginated results
pageSizeintNumber of results per page
chatroomIdintID of the chatroom

ConversationSearchResponse

List of parameters for the ConversationSearchResponse class.

VariableTypeDescriptionOptional
conversationsList<Conversation>List of matched conversations✔️
widgetsMap<String, Widget>?Map of conversation widget✔️