Get Participants
To retrieve the list of participants in a chatroom, LikeMinds React Chat SDK provides this feature. It enables you to retrieve user details, such as usernames or profile information, for better engagement and interaction within the chatroom.
Steps to Get the List of Participants in a Chatroom
- To fetch the list of the participants, use the method
viewParticipants()
provided by the client you initialised. - Pass in the required parameters
chatroomId
,page
,pageSize
andisSecret
. - Process the response as per your requirement.
const payload: any = {
chatroomId: 89899, // The chatroom id
isSecret: true, // true if the chatroom is secret
page: 1, // The required page no.
pageSize: 10, // The size of the page.
};
const response = await lmChatClient.viewParticipants(payload);
if (response.success) {
// your function to process the response data
processResponse(response);
} else {
// your function to process error message
processError(response);
}
View Participants Payload
List of parameters for the viewPartipants
method.
Variable | Type | Description | Optional |
---|---|---|---|
chatroomId | number | Chatroom Id | |
page | number | Page | |
pageSize | number | Page size | |
isSecret | boolean | Is secret chatroom | |
search | String | Search string | ✔️ |
View Participants Response
List of parameters in the response.
Variable | Type | Description |
---|---|---|
success | boolean | API success status |
error_message | string | Error message in case of failure |
participants | array | List of participants |
total_participants_count | boolean | Total participants Count |