SDKsHarmonyOSEnterprise
Create conversation group
Create a new conversation group and optionally associate an initial conversation.
When creating a standard conversation group, supply a name, display sort order, and group category. To immediately link an existing conversation, provide its conversationID.
Code example
import sdk, {
ConversationGroupType,
CreateConversationGroupReq,
CreateConversationGroupResp,
} from '@openimsdk/imsdk';
const request: CreateConversationGroupReq = {
name: 'Work',
order: 100,
conversationGroupType: ConversationGroupType.ConversationGroupTypeNormal,
conversationID: conversationID,
};
const response: CreateConversationGroupResp = await sdk.createConversationGroup(request);
const group = response.conversationGroup;Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Display name for the group. |
order | number | Yes | Numerical sort index defined by application convention. |
conversationGroupType | ConversationGroupType | Yes | Group type (ConversationGroupTypeNormal or ConversationGroupTypeFilter). |
conversationID | string | No | Initial conversation ID to add into the newly created group. |
ex | string | No | Custom application metadata string. |
Return value
Returns a Promise that resolves to a CreateConversationGroupResp object:
| Property | Type | Description |
|---|---|---|
conversationGroup | IMConversationGroup | The newly created conversation group object. |
State changes after the call
Once the Promise resolves, update your local group list by merging the new record using conversationGroupID. Associated clients and other active devices observe changes via EventOnConversationGroupAdded. For complete event lifecycle details, see Conversation groups overview.
Was this page helpful?