Group overview
Understand the relationship between group profiles, member roles, join requests, and group events.
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
| Structure | Purpose |
|---|---|
OpenIMGroupItem | Group name, avatar, announcement, owner, verification mode, member count, and extension fields. |
OpenIMGroupMemberItem | A member's group-specific nickname, role level, mute status, and join metadata. |
OpenIMGroupApplicationItem | A 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:
| Field | Type | Description |
|---|---|---|
groupID | string | The persistent group identifier; serves as the merge key for group events. |
groupName | string | Display name of the group. |
faceURL | string | Avatar image URL for the group. |
notification | string | Group announcement text. |
introduction | string | Group description text. |
ownerUserID | string | The user ID of the current group owner. |
creatorUserID | string | The user ID of the member who created the group. |
memberCount | number | Member count at the time of query. |
groupType | OpenIMGroupType | Group type; standard working groups use OpenIMGroupTypeWorkingGroup. |
needVerification | OpenIMGroupVerificationType | Group join verification policy. |
lookMemberInfo | OpenIMGroupAllowType | Whether members are permitted to view fellow member profiles. |
applyMemberFriend | OpenIMGroupAllowType | Whether members are permitted to send friend requests to fellow members. |
notificationUpdateTime | number | Announcement update timestamp in Unix milliseconds. |
notificationUserID | string | User ID of the member who last updated the announcement. |
createTime | number | Group creation timestamp in Unix milliseconds. |
status | OpenIMGroupStatus | Group operational state (OpenIMGroupStatusNormal, OpenIMGroupStatusBanned, OpenIMGroupStatusDismissed, OpenIMGroupStatusMuted). |
ex | string | Custom group extension string. |
attachedInfo | string | Internal SDK metadata. |
displayIsRead Commercial | boolean | null | Server configuration controlling read receipt visibility; read-only from the client. |
Group configuration guides
- Create a group
- Update group profile
- Set group announcement
- Set group extension data
- Set group join verification
- Set member profile access
- Set member friend request permissions
- Mute or unmute a group
Group membership and queries
- Join a group
- Quit a group
- Dismiss a group
- Get specified group profiles
- Get joined groups
- Get joined groups with pagination
- Check group membership
- Search joined groups
Group join applications
- Get received group applications
- Get sent group applications
- Get unhandled group application count
- Accept a group application
- Reject a group application
Group members
- Get group member list
- Get specified group member info
- Get user group membership
- Search group members
- Invite users to a group
- Kick a group member
- Set group member nickname
- Set group member role level
- Set group member avatar
- Set group member extension data
- Transfer group ownership
- Mute or unmute a group member
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.
Was this page helpful?