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

Create a quote message

Reference an existing message to create a quoted reply message.

Copy

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

ParameterTypeRequiredDescription
textstringYesBody text of your reply.
messagestringYesSerialized 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) return

The 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.