Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Join group

Submit an application to join a group, or join directly if verification is disabled.

Copy

Whether joining requires administrator review depends on the group's needVerification setting; the joinSource parameter records the acquisition channel:

Code example

import sdk, { GroupJoinSource, JoinGroupReq } from '@openimsdk/imsdk';

const request: JoinGroupReq = {
  groupID: groupID,
  reqMsg: 'Applying to join the project team',
  joinSource: GroupJoinSource.Search,
  ex: '',
};
await sdk.joinGroup(request);

Parameters

ParameterTypeRequiredDescription
groupIDstringYesTarget group identifier.
reqMsgstringYesVerification note or greeting string. Pass an empty string if none.
joinSourceGroupJoinSourceYesSource channel enum (e.g., search, QR code, invitation link).
exstringYesApplication metadata string. Pass an empty string if none.

Return value

Returns a Promise that resolves to void when the request is processed by the server.

State changes after the call

Resolving the Promise indicates that the application was submitted. If the group requires approval, track review progress via Retrieve sent group applications. If the group allows direct entry, the user joins immediately and the SDK triggers EventOnJoinedGroupAdded; add the group to your joined groups list keyed by groupID, as detailed in Group overview.