Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Check users in group

Verify which users from a given list are currently members of a specified group.

Copy

Use this method when you only need to verify group membership status without fetching full member profiles.

Code example

import sdk, { GetUsersInGroupReq, GetUsersInGroupResp } from '@openimsdk/imsdk';

const request: GetUsersInGroupReq = {
  groupID: groupID,
  userIDs: candidateUserIDs,
};
const response: GetUsersInGroupResp = await sdk.getUsersInGroup(request);
const confirmedUserIDs = response.userIDs;

Parameters

ParameterTypeRequiredDescription
groupIDstringYesTarget group identifier.
userIDsstring[]YesArray of user IDs to check.

Return value

Returns a Promise resolving to GetUsersInGroupResp:

PropertyTypeDescription
userIDsstring[]Array containing only user IDs from the input list who currently belong to the group.

State changes after the call

The returned array contains only user IDs from the input list who are currently members of the group, omitting full profile details. This query reflects an instantaneous snapshot. To maintain an active member roster with real-time updates, see Retrieve group member list.