Browse SDKs · WASM
SDKsWASM

Create a reply message

Create a reply that includes a reference to the original message.

Copy

A reply contains new text and a complete reference to the original message. Read the original MessageItem from the current message list and confirm that it still belongs to the active conversation before creating the reply.

const { data: message } = await openimsdk.createQuoteMessage({
  text: 'I agree with this proposal',
  message: JSON.stringify(originalMessage),
});

text is the new message body, and message is the serialized original MessageItem. Do not assemble the original message fields manually. Check empty input and content length according to the application's rules before sending.

When the Promise resolves, data is a new pending MessageItem, and the referenced message is unchanged. Next, use Send a message to send it. The receiving client should show a clear fallback when the original message was deleted or cannot be rendered.