Browse SDKs · React Native
Platform
SDKsReact Native

Create a group

Create a new group with initial members, administrators, and owner using the OpenIM React Native SDK.

Copy

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

ParameterTypeRequiredDescription
memberUserIDsstring[]YesList of user IDs for initial regular members.
adminUserIDsstring[]NoList of user IDs designated as initial administrators.
ownerUserIDstringNoUser ID of the group owner; defaults to the authenticated user if omitted.
groupInfoPartial<GroupItem>YesInitial 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.