Skip to main content

View Participants

To retrieve the list of participants in a chatroom, LM React Native 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

  1. To fetch the list of the participants, use the method getParticipants provided by the client you initialised.
  2. Pass in the required parameters chatroomId, page, pageSize and isSecret.
  3. 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?.getParticipants(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 getParticipants method.

VariableTypeDescriptionOptional
chatroomIdnumberChatroom Id
pagenumberPage int
pageSizenumberPage size
isSecretbooleanIs secret chatroom
searchStringSearch string✔️

View Participants Response

List of parameters in the response.

VariableTypeDescription
successbooleanAPI success status
error_messagestringError message in case of failure
participantsarrayList of participants
total_participants_countbooleanTotal participants Count