Create a conversation group
Create a new conversation group and optionally assign an initial conversation to it.
Creating conversation groups is a Commercial Edition capability. When creating a custom group, supply the group name, order index, and group type. To associate an initial conversation with the new group immediately upon creation, supply conversationID.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name of the conversation group. |
order | number | Yes | Sequence order index used for tab or list sorting. |
conversationGroupType | OpenIMConversationGroupType | Yes | Use OpenIMConversationGroupTypeNormal for custom user groups, or OpenIMConversationGroupTypeFilter for rule-filtered groups. |
conversationID | string | null | No | Identifier of a conversation to add to the group immediately upon creation. |
ex | string | null | No | Custom application-defined extension string. |
Code example
import {
OpenIMConversationGroupTypeNormal,
createConversationGroup,
} from '@/uni_modules/unix-openim-sdk'
const result = await createConversationGroup({
name: 'Work',
order: 100,
conversationGroupType: OpenIMConversationGroupTypeNormal,
conversationID,
})
const group = result?.conversationGroupReturn value
The Promise resolves with an OpenIMCreateConversationGroupResult | null object. The newly created group item is located in conversationGroup (OpenIMConversationGroupItem).
State changes after the call
Upon Promise resolution, insert or update the conversation group in your local view models using conversationGroupID as the merge key. When group events arrive or upon reconnecting, re-query the full group list to calibrate state as shown in Conversation group overview.
Was this page helpful?