Browse SDKs · uni-app / uni-app x
Platform
SDKsuni-app / uni-app xIncludes Enterprise features

Group overview

Understand the relationship between group profiles, member roles, join requests, and group events.

Copy

OpenIMSDK organizes multi-user chats, shared profiles, member rosters, and permissions through groups. When sending group messages, managing group settings, inviting members, and reviewing join applications, supply the groupID. In contrast, the authenticated user's conversation list entry for that group chat is identified by conversationID; do not conflate the two identifiers.

Core data structures

StructurePurpose
OpenIMGroupItemGroup name, avatar, announcement, owner, verification mode, member count, and extension fields.
OpenIMGroupMemberItemA member's group-specific nickname, role level, mute status, and join metadata.
OpenIMGroupApplicationItemA group join application along with its current review status.

Group member role levels are evaluated using OpenIMGroupMemberRoleNormal, OpenIMGroupMemberRoleAdmin, and OpenIMGroupMemberRoleOwner. While the client can conditionally reveal management actions based on role, OpenIMServer authoritative verification always enforces final permissions.

Group profile fields

The OpenIMGroupItem structure contains the following core fields:

FieldTypeDescription
groupIDstringThe persistent group identifier; serves as the merge key for group events.
groupNamestringDisplay name of the group.
faceURLstringAvatar image URL for the group.
notificationstringGroup announcement text.
introductionstringGroup description text.
ownerUserIDstringThe user ID of the current group owner.
creatorUserIDstringThe user ID of the member who created the group.
memberCountnumberMember count at the time of query.
groupTypeOpenIMGroupTypeGroup type; standard working groups use OpenIMGroupTypeWorkingGroup.
needVerificationOpenIMGroupVerificationTypeGroup join verification policy.
lookMemberInfoOpenIMGroupAllowTypeWhether members are permitted to view fellow member profiles.
applyMemberFriendOpenIMGroupAllowTypeWhether members are permitted to send friend requests to fellow members.
notificationUpdateTimenumberAnnouncement update timestamp in Unix milliseconds.
notificationUserIDstringUser ID of the member who last updated the announcement.
createTimenumberGroup creation timestamp in Unix milliseconds.
statusOpenIMGroupStatusGroup operational state (OpenIMGroupStatusNormal, OpenIMGroupStatusBanned, OpenIMGroupStatusDismissed, OpenIMGroupStatusMuted).
exstringCustom group extension string.
attachedInfostringInternal SDK metadata.
displayIsRead Commercialboolean | nullServer configuration controlling read receipt visibility; read-only from the client.

Group configuration guides

Group membership and queries

Group join applications

Group members

Monitor group updates

Group profile changes, join/leave transitions, and group dismissal events are centrally monitored here. The callback handlers receive an OpenIMGroupItem | null object; when non-null, update your cached records by matching groupID:

import {
  OpenIMGroupItem,
  off,
  onGroupDismissed,
  onGroupInfoChanged,
  onJoinedGroupAdded,
  onJoinedGroupDeleted,
} from '@/uni_modules/unix-openim-sdk'

const handleGroupChanged = (group: OpenIMGroupItem | null) => {
  if (group == null) return
  mergeGroup(group)
}

const handleJoinedGroupDeleted = (group: OpenIMGroupItem | null) => {
  if (group == null) return
  removeJoinedGroup(group.groupID)
}

const handleGroupDismissed = (group: OpenIMGroupItem | null) => {
  if (group == null) return
  markGroupDismissed(group.groupID)
}

const joinedGroupAddedSubscription = onJoinedGroupAdded(handleGroupChanged)
const joinedGroupDeletedSubscription = onJoinedGroupDeleted(
  handleJoinedGroupDeleted,
)
const groupInfoChangedSubscription = onGroupInfoChanged(handleGroupChanged)
const groupDismissedSubscription = onGroupDismissed(handleGroupDismissed)

function removeGroupListeners() {
  off(joinedGroupAddedSubscription)
  off(joinedGroupDeletedSubscription)
  off(groupInfoChangedSubscription)
  off(groupDismissedSubscription)
}

Unsubscribe from these listeners when logging out, switching user accounts, or tearing down the group store. Promise resolution, event delivery, and state re-queries represent distinct phases; when addition or removal events occur during pagination, reset the offset and reload the list.