Browse SDKs · React Native
Platform
SDKsReact Native

Insert local group message

Insert a message directly into local storage for a group chat without sending over the network using the OpenIM React Native SDK.

Copy

Write a group message directly into local device database storage:

This method persists the message record only in the local client database without sending it across the network to the server or other group members. It is commonly used for inserting onboarding tips, system alerts, or UI placeholder notices.

const localMessage = await OpenIMSDK.insertGroupMessageToLocalStorage({
  message,
  groupID,
  sendID,
});

Parameters

ParameterTypeRequiredDescription
messageMessageItemYesComplete message object to store locally, typically constructed via message creation methods.
groupIDstringYesTarget group ID.
sendIDstringYesSender user ID, which can be the current user or a virtual system user ID.

Return value

A resolved Promise returns the MessageItem written to the local database. The message is indexed locally by clientMsgID. To dispatch standard messages over the network to other group members, use Send message.