Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Create quote message

Quote an existing message with a simple text reply.

Copy

Creates a quote message referencing a previous message with text reply content.

Code example

import sdk, { CreateQuoteMessageReq, CreateQuoteMessageResp } from '@openimsdk/imsdk';

const request: CreateQuoteMessageReq = {
  text: 'Received, I will handle it today.',
  quoteMessage: originalMessage,
};
const response: CreateQuoteMessageResp = await sdk.createQuoteMessage(request);
const message = response.message;

Parameters

ParameterTypeRequiredDescription
textstringYesReply body text.
quoteMessageIMMessageYesThe original message being quoted.

Return value

Returns a Promise resolving to CreateQuoteMessageResp:

PropertyTypeDescription
messageIMMessageLocally instantiated quote message object.

State changes after the call

originalMessage should come directly from query results or message events; do not fabricate incomplete mock objects. Verify that the referenced message belongs to the active conversation, and design a fallback UI in case the original message has been deleted or cannot be loaded. Resolving the Promise constructs the message object locally; call Send message to dispatch it.