Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Retrieve conversations in a group

Paginate conversations belonging to a specific conversation group along with group details.

Copy

Query conversation group details and its member conversations within a single paginated response.

Code example

import sdk, {
  GetConversationGroupInfoWithConversationsReq,
  GetConversationGroupInfoWithConversationsResp,
} from '@openimsdk/imsdk';

const request: GetConversationGroupInfoWithConversationsReq = {
  conversationGroupID: conversationGroupID,
  pagination: {
    pageNumber: 1,
    showNumber: 20,
  },
};
const response: GetConversationGroupInfoWithConversationsResp =
  await sdk.getConversationGroupInfoWithConversations(request);

renderConversationGroup(response.conversationGroup, response.conversations);

Parameters

ParameterTypeRequiredDescription
conversationGroupIDstringYesTarget conversation group identifier.
pagination.pageNumbernumberYesPage index, starting from 1.
pagination.showNumbernumberYesNumber of conversations to retrieve per page.

Return value

Returns a Promise that resolves to a GetConversationGroupInfoWithConversationsResp object:

PropertyTypeDescription
conversationGroupIMConversationGroupProfile metadata of the queried conversation group.
conversationsIMConversation[]List of conversation records for the current page.
isEndbooleanWhether the final page of conversations has been reached.

State changes after the call

If member association events arrive while paging through the list, reset the pagination offset and re-query from the first page to prevent inconsistent page boundary snapshots. For event listeners, see Conversation groups overview.