Browse SDKs · uni-app / uni-app x
Platform
SDKsuni-app / uni-app x

Insert a local group message

Insert a message record directly into the local database for a group chat.

Copy

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

ParameterTypeRequiredDescription
messageOpenIMMessageItemYesFully constructed message object created via a message creation method.
groupIDstringYesIdentifier of the target group.
sendIDstringYesSender 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.