Browse SDKs · uni-app / uni-app x
SDKsuni-appEnterprise

Get conversation groups

OpenIM uni-app / uni-app x SDK guide for Get conversation groups.

Copy

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:

FieldTypeDescription
conversationGroupIDstring or nullStable group ID and merge key for group events. Validate it before caching.
namestring or nullDisplay name.
ordernumber or nullServer/Core sort value.
conversationGroupTypenumber or nullGroup type.
conversationIDsstring[] or nullConversation IDs included in this snapshot, not complete conversation objects.
hiddenboolean or nullWhether the group is hidden.
unreadCountnumber or nullAggregate unread-count snapshot.
exstring or nullApplication 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.