Members List
LikeMinds React Chat SDK offers a convenient feature that enables the retrieval of a list of members for direct messaging (DM) purposes.
Steps to get the list of members in the community
- To fetch the list of the members, use the method
getAllMembers()
provided by the client you initialised. - Pass in the required parameters
page
. - Process the response as per your requirement.
// get show_list value from `checkDMStatus` method
const memberPayload: any = {
page: 1,
};
const cmPayload: any = {
page: 1,
memberState: 1, // 1 for CM or 4 for members
};
const response = await lmChatClient.getAllMembers(
show_list === 1 ? memberPayload : cmPayload
);
if (response.success) {
// your function to process the response data
processResponse();
} else {
// your function to process error message
processError(response);
}
Get All Members Payload
List of parameters for the getAllMembers()
function.
Variable | Type | Description | Optional |
---|---|---|---|
page | number | Page | |
memberState | int | State of logged in user | ✔️ |
Get All Members Response
List of parameters in the response.
Variable | Type | Description |
---|---|---|
success | boolean | API success status |
error_message | string | Error message in case of failure |
members | object | List of members |
Search in Members List
LikeMinds React Chat SDK offers a powerful feature that allows you to easily search within the members list, facilitating efficient discovery of specific members for direct messaging (DM) purposes.
Steps to search members in a community
- To search the list of the members, use the method
searchMembers()
provided by the client you initialised. - Pass in the required parameters
page
,pageSize
,search
andsearchType
. - Process the response as per your requirement.
// get show_list value from `checkDMStatus()` method
const memberPayload: any = {
search: searchString, // string that you have searched
searchType: "name", // type of search
page: 1,
pageSize: 10, // list of members you want in a page
};
const cmPayload: any = {
search: searchString, // string that you have searched
searchType: "name", // type of search
page: 1,
pageSize: 10, // list of members you want in a page
memberStates: "[1]", // for CM
};
const response = await lmChatClient.searchMembers(
show_list === 1 ? memberPayload : cmPayload
);
if (response.success) {
// your function to process the response data
processResponse();
} else {
// your function to process error message
processError(response);
}
Search Members Payload
List of parameters for the searchMembers()
function.
Variable | Type | Description | Optional |
---|---|---|---|
page | number | Page | |
search | string | String that you have searched | |
searchType | string | Type of search | |
pageSize | number | List of members you want in a page | |
memberState | number | State of logged in user | ✔️ |
Search Members Response
List of parameters in the response.
Variable | Type | Description |
---|---|---|
success | boolean | API success status |
error_message | string | Error message in case of failure |
members | object | List of members |