Insert a local group message
Insert a message record directly into the local database for a group chat.
Invoke insertGroupMessageToLocalStorage() to inject a message directly into the local database for a group conversation. This is suitable for device-local administrative notices, system hints, or data migration records.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
message | OpenIMMessageItem | Yes | Fully constructed message object created via a message creation method. |
groupID | string | Yes | Identifier of the target group. |
sendID | string | Yes | Sender user ID for the message. |
Code example
import { insertGroupMessageToLocalStorage } from '@/uni_modules/unix-openim-sdk'
await insertGroupMessageToLocalStorage({
message,
groupID,
sendID: currentUserID,
})The groupID and sendID must match the target group conversation and sender identity accurately.
Return value
The Promise resolves with void upon successful insertion into the local database.
State changes after the call
Promise resolution indicates that the message was saved to local storage. Update your local view model using groupID:clientMsgID. This call does not deliver messages to fellow group members, trigger push alerts, or emit new message events. To transmit messages to group members across the network, use Send a message.
Was this page helpful?