SDKsHarmonyOSEnterprise
Join group
Submit an application to join a group, or join directly if verification is disabled.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
groupID | string | Yes | Target group identifier. |
reqMsg | string | Yes | Verification note or greeting string. Pass an empty string if none. |
joinSource | GroupJoinSource | Yes | Source channel enum (e.g., search, QR code, invitation link). |
ex | string | Yes | Application 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.
Was this page helpful?