Browse SDKs · WASM
SDKsWASM

Apply to join a group

Apply to join a group, or join directly when approval is not required.

Copy

joinGroup() submits a join request with a group ID, application message, and join source.

Parameters

ParameterTypeRequiredDescription
groupIDstringYesTarget group ID.
reqMsgstringYesApplication message. Pass an empty string when there is none.
joinSourceGroupJoinSourceYesHow the user initiated the join.
exstringNoApplication extension string.
Enum valueNumeric valueMeaning
GroupJoinSource.Invitation2Joined through an invitation.
GroupJoinSource.Search3Joined through search.
GroupJoinSource.QrCode4Joined through a QR code.
import { GroupJoinSource } from '@openim/wasm-client-sdk';

await openimsdk.joinGroup({
  groupID,
  reqMsg: 'Please add me to the project discussion group',
  joinSource: GroupJoinSource.Search,
});

joinSource records only the path used to join and does not determine whether approval is required. When approval is required, a successful Promise means only that the application was submitted. Update the joined-group list from OnJoinedGroupAdded only after the account actually joins. See Group overview for complete event handling.