Browse SDKs · uni-app / uni-app x
Platform
SDKsuni-app / uni-app x

Invite users to a group

Invite one or more users to join a specified group.

Copy

Invoke inviteUserToGroup() as a group owner or administrator with invitation privileges to invite target users into a group. While clients can conditionally show the action based on member roleLevel, OpenIMServer authoritative verification always enforces final permissions.

Parameters

ParameterTypeRequiredDescription
groupIDstringYesTarget group identifier.
reasonstringYesInvitation description or greeting; pass an empty string if omitted.
userIDListstring[]YesAn array of user IDs to invite; deduplicate before invoking.

Code example

import { inviteUserToGroup } from '@/uni_modules/unix-openim-sdk'

await inviteUserToGroup({
  groupID: groupID,
  reason: 'Inviting to project discussion group',
  userIDList: ['user-002', 'user-003'],
})

Return value

The Promise resolves with void once OpenIMServer accepts the invitation request.

State changes after the call

A resolved Promise indicates that the invitation request was submitted; it does not guarantee that the invited users appear immediately in the member roster. Depending on the group's needVerification policy, invitations may require callee acceptance or admin review. Only when members successfully join and the onGroupMemberAdded event fires should you add them to the local roster using the composite key groupID:userID. For complete member event handling, see Get group member list.