Home Feed
The Home Feed is a vital component of many applications, providing users with a centralized hub to discover and engage with various content, including chatrooms, discussions, and other interactive features. In the context of the React SDK, the Home Feed serves as a customizable and dynamic feed that can be tailored to suit your application's needs.
This guide provide step-by-step instructions, code snippets, and best practices for integrating the Home Feed and fetching community chatrooms in your React app.
Let's dive into the world of Home Feed integration with the React SDK and unlock the potential for vibrant chatroom communities within your application.
Steps to fetch chatrooms in Homefeed
- To fetch HomeFeed in groupchat, use the method
getHomeFeed()
provided by the client. - Pass the required parameter page.
- Process the response as per your requirement.
const payload: any = {
page: 1,
};
const response = await lmChatClient.getHomeFeed(payload);
if (response.success) {
// your function to process the response data
processResponse(response);
} else {
// your function to process error message
processError(response);
}
Get Home Feed Request
Variable | Type | Description | Optional |
---|---|---|---|
page | int | page |
Get Home Feed Response
Variable | Type | Description |
---|---|---|
success | boolean | API success status |
error_message | string | Error message in case of failure |
my_chatrooms | object | List of chatrooms |
Search Chatrooms
LikeMinds React Chat SDK provides you with the ability to search for the chatroom. This enables you to avoid scrolling down that bottomless list of feeds and rebustly look and open that long lost conversation you once had.
Steps to search chatrooms on home feed
- To search for the desired chatroom use the
searchChatroom()
function provided by the SDK. - Pass in the required parameters.
- Parse the response as per your requirement.
const payload: any = {
followStatus: true,
search: "chatroom name",
pageSize: 10,
page: 1,
searchType: "header",
};
const response = await lmChatClient.searchChatroom(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 searchChatroom()
Variable | Type | Description | Optional |
---|---|---|---|
followStatus | boolean | Values: true for followed chatrooms and false for unfollowed. | |
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 |
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 |
chatrooms | List | List of chatrooms |