Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Add conversations to groups

Associate one or more conversations with designated conversation groups.

Copy

This method only manages the association between conversations and groups; it does not create conversations or alter message destinations.

Code example

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

const request: AddConversationsToGroupsReq = {
  conversationIDs: [conversationID],
  conversationGroupIDs: [conversationGroupID],
};
await sdk.addConversationsToGroups(request);

Parameters

ParameterTypeRequiredDescription
conversationIDsstring[]YesList of conversation IDs to add.
conversationGroupIDsstring[]YesTarget conversation group IDs.

Return value

Returns a Promise that resolves to void when the association request is processed.

State changes after the call

Resolving the Promise confirms that the request was processed by the server; it does not guarantee that asynchronous group member events have arrived across all devices. When EventOnConversationGroupMemberAdded arrives, merge updates using conversationGroupID and conversationID. For listener registration, see Conversation groups overview. Re-query affected groups if you need authoritative reconciliation.