Search Conversation
LikeMinds React Chat SDK provides you with the ability to search for the conversations inside a chatroom. This enables you to quickly look for the conversation through a search key instead of endlessly scrolling up for that.
Steps to Search for a conversation inside a chatroom
- To search for the desired chatroom use the
searchConversation()
function provided by the SDK. - Pass in the essential payload.
- Parse the response as per your requirement.
const payload: any = {
chatroomId: 89899,
search: "search key",
followStatus: true,
page: 1,
pageSize: 10,
};
const response = await lmChatClient.searchConversation(payload);
if (response.success) {
// your function to process the response data
processResponse(response);
} else {
// your function to process error message
processError(response);
}
Search Chatroom payload
List of parameters provided by the searchConversation()
Variable | Type | Description | Optional |
---|---|---|---|
followStatus | boolean | To indicate whther to search for an already following chatroom or run for unfollowed one | |
page | number | Page | |
pageSize | number | Queries returned in each pagesize | |
searchType | string | Can take two values, header or title string | |
search | string | Key to search for | |
chatroomId | string | Id of the chatroom |
Search Chatroom Payload
List of parameters in the response.
Variable | Type | Description |
---|---|---|
success | boolean | API success status |
error_message | String | Error message in case of failure |
conversations | List | List of conversations |