Invite user to group
Invite one or more users to join a specified group.
Clients can control UI actions based on current member roles, while final permissions are strictly enforced by OpenIMServer.
Code example
import sdk, { InviteUserToGroupReq } from '@openimsdk/imsdk';
const request: InviteUserToGroupReq = {
groupID: groupID,
userIDs: ['user_002', 'user_003'],
reason: 'Invited to join project team',
};
await sdk.inviteUserToGroup(request);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
groupID | string | Yes | Target group identifier. |
userIDs | string[] | Yes | Array of user IDs to invite. |
reason | string | No | Invitation reason or note. |
Return value
Returns a Promise that resolves to void when the invitation request is accepted by the server.
State changes after the call
Deduplicate userIDs before initiating the call. Promise resolution indicates that the invitation was submitted to the server; it does not guarantee immediate member list addition. Depending on group verification settings, invitations may require user confirmation or admin approval. When users actually join and member addition events fire, update local rosters using groupID:userID. For complete event listener setups, see Retrieve group member list.
Was this page helpful?