Get conversation groups
OpenIM uni-app / uni-app x SDK guide for Get conversation groups.
getConversationGroups() Commercial queries groups by conversationGroupType.
conversationGroupType is a required OpenIMConversationGroupQueryType. Use the contract value for normal custom groups when rendering the normal grouping UI, or the contract value that queries all types when the product needs a complete snapshot. Do not mix a creation type, UI tab index, or local enum with the query type.
import { getConversationGroups } from '@/uni_modules/unix-openim-sdk'
const result = await getConversationGroups({ conversationGroupType: 0 })
const groups = result?.conversationGroups ?? []Return result
The Promise resolves directly to OpenIMGetConversationGroupsResult or null. Read the snapshot from conversationGroups, deduplicate valid IDs, and sort by order.
Conversation-group fields
Every OpenIMConversationGroupItem field can be absent:
| Field | Type | Description |
|---|---|---|
conversationGroupID | string or null | Stable group ID and merge key for group events. Validate it before caching. |
name | string or null | Display name. |
order | number or null | Server/Core sort value. |
conversationGroupType | number or null | Group type. |
conversationIDs | string[] or null | Conversation IDs included in this snapshot, not complete conversation objects. |
hidden | boolean or null | Whether the group is hidden. |
unreadCount | number or null | Aggregate unread-count snapshot. |
ex | string or null | Application extension string; parse only a confirmed format. |
The item stores conversation IDs rather than complete conversation details. Use Get a group with its conversations when member conversation objects, pages, and the total count are needed.
This operation only establishes a snapshot and does not trigger a group event. Merge later incremental events and query again to reconcile after reconnect, account change, or an event gap. See Conversation groups overview for the event list.
Was this page helpful?