Browse SDKs · React Native
Platform
SDKsReact NativeIncludes Enterprise features

Group overview

Understand group profiles, group members, join applications, and group events in the OpenIM React Native SDK.

Copy

Multi-party messaging in OpenIM is anchored on groups. Group-related APIs use groupID to identify the group entity—such as querying group profiles, managing members, and reviewing join applications. Group conversations use conversationID to manage conversation settings, message history, and unread counters. Keep groupID (the group entity) and conversationID (the chat session) distinct in your code.

Core data structures

StructureDescription
GroupItemGroup name, avatar, announcement, owner, join verification policy, member count, and custom extensions.
GroupMemberItemA member's group-scoped nickname, role level, muting duration, and join metadata within a specific group.

Group member roles are enumerated in GroupMemberRole: Normal for standard members, Admin for administrators, and Owner for the group creator/owner.

GroupItem properties

FieldTypeDescription
groupIDstringGroup ID and unique reconciliation key for group profiles.
groupNamestringGroup title.
notificationstringGroup announcement text.
friendUserIDsstringFriend user IDs associated with this group.
remarkstringGroup remark alias set by the current account.

GroupMemberItem properties

FieldTypeDescription
groupIDstringTarget group ID to which this member belongs.
userIDstringMember user ID.
nicknamestringMember's display name inside this specific group.
faceURLstringMember's avatar image URL inside this specific group.
roleLevelGroupMemberRoleMember role: Normal, Admin, or Owner.
muteEndTimenumberTimestamp in Unix seconds when the member mute expires.
joinTimenumberJoin timestamp in Unix seconds.
joinSourceGroupJoinSourceMethod or invitation through which the member joined.
inviterUserIDstringUser ID of the member who extended the invitation.
operatorUserIDstringUser ID of the administrator who last modified this member.
exstringMember-specific extension string.

Note that nickname, faceURL, and roleLevel are strictly scoped to the specified group and do not alter the user's global profile.

Browse by task

Listen for group changes

Group membership additions, removals, profile modifications, and dissolutions trigger OnJoinedGroupAdded, OnJoinedGroupDeleted, OnGroupInfoChanged, and OnGroupDismissed:

const handleJoinedGroupAdded = (group: GroupItem) => {
  // Add group to joined groups list
};

const handleJoinedGroupDeleted = (group: GroupItem) => {
  // Remove group matching group.groupID
};

const handleGroupInfoChanged = (group: GroupItem) => {
  // Update group properties matching group.groupID
};

const handleGroupDismissed = (group: GroupItem) => {
  // Remove or disable dismissed group matching group.groupID
};

// Register listeners
OpenIMSDK.on(OpenIMEvent.OnJoinedGroupAdded, handleJoinedGroupAdded);
OpenIMSDK.on(OpenIMEvent.OnJoinedGroupDeleted, handleJoinedGroupDeleted);
OpenIMSDK.on(OpenIMEvent.OnGroupInfoChanged, handleGroupInfoChanged);
OpenIMSDK.on(OpenIMEvent.OnGroupDismissed, handleGroupDismissed);

// Remove listeners
OpenIMSDK.off(OpenIMEvent.OnJoinedGroupAdded, handleJoinedGroupAdded);
OpenIMSDK.off(OpenIMEvent.OnJoinedGroupDeleted, handleJoinedGroupDeleted);
OpenIMSDK.off(OpenIMEvent.OnGroupInfoChanged, handleGroupInfoChanged);
OpenIMSDK.off(OpenIMEvent.OnGroupDismissed, handleGroupDismissed);

Unregister these listeners when the group view unmounts, the user signs out, or accounts switch. Member updates are covered in Get group member list by page, and application events in Get received group applications.