Create a forward message
Construct a forwarded message from an existing sent message.
Invoke createForwardMessage() with an existing OpenIMMessageItem to duplicate its payload into a new pending message that can be transmitted to a different recipient or group.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sourceMessage | OpenIMMessageItem | Yes | Existing message item to be forwarded. |
Code example
import { createForwardMessage } from '@/uni_modules/unix-openim-sdk'
const message = await createForwardMessage(sourceMessage)
if (message == null) returnThe sourceMessage must be a valid sent message obtained from history queries or message events. Ensure the user retains permission to view and propagate the content. Device-specific attributes or expired temporary URLs may not function when forwarded.
Return value
The Promise resolves with an OpenIMMessageItem | null object. Forwarding does not mutate the source message or automatically transmit data to the target chat.
State changes after the call
Pass the constructed message item to Send a message, supplying the destination recvID or groupID. If you prefer to combine multiple selected messages into a single chat history card, use Create a merger message.
Was this page helpful?