Browse SDKs · WASM
SDKsWASMEnterprise

Get conversation groups

Get the current user’s conversation groups by type.

Copy

Use getConversationGroups() to establish a snapshot of the signed-in user's conversation groups for one group type.

import { ConversationGroupType } from '@openim/wasm-client-sdk';

const { data: groups } = await openimsdk.getConversationGroups(
  ConversationGroupType.ConversationGroupTypeNormal,
);

The parameter is a ConversationGroupType. Pass ConversationGroupTypeNormal for normal custom groups or ConversationGroupTypeAll for all types.

Return result

After the Promise succeeds, data contains the matching ConversationGroup[]. Identify groups by conversationGroupID when rendering or caching them.

Conversation group fields

FieldTypeDescription
conversationGroupIDstringStable conversation group ID and merge key for group events.
namestringGroup name.
conversationGroupTypeConversationGroupTypeGroup type, such as a normal custom group or filtered group.
conversationIDsstring[]Conversation IDs directly contained in the group.
serialnumberGroup ordering value stored by the server.
hiddenbooleanWhether the group is hidden.
unreadCountnumberAggregate unread count for conversations in the group.
versionnumberGroup data version used to distinguish older and newer snapshots.
exstring (optional)Application-defined group extension string.

The group stores only conversationIDs, not complete conversation details. Use Get conversations in a group when both are required.

This query establishes a snapshot only and does not trigger a group event. Merge later changes from incremental events and query again when needed for reconciliation. See Conversation group overview for the event list.