Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Query group IDs by conversation ID

Retrieve all conversation groups currently associated with a specific conversation.

Copy

A conversation can belong to multiple groups simultaneously. This method returns complete conversation group objects rather than just raw string IDs.

Code example

import sdk, {
  GetConversationGroupByConversationIDReq,
  GetConversationGroupByConversationIDResp,
} from '@openimsdk/imsdk';

const request: GetConversationGroupByConversationIDReq = {
  conversationID: conversationID,
};
const response: GetConversationGroupByConversationIDResp =
  await sdk.getConversationGroupByConversationID(request);
const groups = response.conversationGroups;

Parameters

ParameterTypeRequiredDescription
conversationIDstringYesTarget OpenIM conversation identifier (not a chat group ID).

Return value

Returns a Promise that resolves to a GetConversationGroupByConversationIDResp object:

PropertyTypeDescription
conversationGroupsIMConversationGroup[]Array of complete conversation groups linked to this conversation.

State changes after the call

Resolving the Promise provides the current group associations for this conversation without triggering real-time events. Extract conversationGroupID from each item if you only need the IDs. When group associations change, synchronize state via the events described in Conversation groups overview or re-invoke this query.