Invite users to a group
Invite one or more users to join a specified group.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
groupID | string | Yes | Target group identifier. |
reason | string | Yes | Invitation description or greeting; pass an empty string if omitted. |
userIDList | string[] | Yes | An 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.
Was this page helpful?