Create a quote message
Reference an existing message to create a quoted reply message.
Invoke createQuoteMessage() to reference an existing message and produce a quoted reply message item. Supply the reply body in text, and pass the serialized JSON representation of the target message in message.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Body text of your reply. |
message | string | Yes | Serialized JSON string of the original OpenIMMessageItem being quoted. |
Code example
import { createQuoteMessage } from '@/uni_modules/unix-openim-sdk'
const message = await createQuoteMessage({
text: 'Acknowledged, handling today.',
message: JSON.stringify(originalMessage),
})
if (message == null) returnThe originalMessage must originate from SDK history queries or incoming message events; do not use incomplete manually assembled objects. Confirm that the quoted message belongs to the active conversation, and provide fallback UI rendering if the referenced message was subsequently deleted or revoked.
Return value
The Promise resolves with an OpenIMMessageItem | null object. Quoting does not alter or re-transmit the original message record.
State changes after the call
Pass the constructed message item to Send a message. Track message status updates in your UI state using the returned clientMsgID.
Was this page helpful?