Browse SDKs · WASM
SDKsWASMEnterprise

Get conversation groups

Get the current user’s conversation groups by type.

Copy

Use getConversationGroups() to retrieve 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 used to find and update the same group when an event arrives.
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 determine which data is newer.
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 returns the group data available at the time of the call and does not trigger a group event. When a later event arrives, use conversationGroupID to update the matching group. Query again when the latest data must be confirmed. See Conversation group overview for the event list.