SDKsReact Native
Create a group
Create a new group with initial members, administrators, and owner using the OpenIM React Native SDK.
Create a new group chat and configure initial members, administrators, and the group owner:
const group = await OpenIMSDK.createGroup({
memberUserIDs: ['user-003', 'user-004'],
adminUserIDs: ['user-002'],
ownerUserID: currentUserID,
groupInfo: {
groupName: 'Project Team',
groupType: GroupType.WorkingGroup,
faceURL: 'https://example.com/group.png',
},
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
memberUserIDs | string[] | Yes | List of user IDs for initial regular members. |
adminUserIDs | string[] | No | List of user IDs designated as initial administrators. |
ownerUserID | string | No | User ID of the group owner; defaults to the authenticated user if omitted. |
groupInfo | Partial<GroupItem> | Yes | Initial group metadata object, including groupName, groupType, and faceURL. |
Do not duplicate user IDs across member, admin, and owner arrays. Specify GroupType.WorkingGroup for standard working groups.
Return value
Resolves to the newly created GroupItem object. Use the returned groupID to open the group conversation or navigate to the chat room.
Upon group creation, the creator and initial members receive the OnJoinedGroupAdded event. Merge the new group into your joined group list keyed by groupID, and track member statuses with the composite key groupID:userID. For event listeners, see Group overview.
Was this page helpful?