Skip to main content

Overview

Returns an async function that deletes a message. Once the server accepts the delete, the message in the local store becomes the placeholder the server returns for it: for your own message, userDeletedAt is set and its content is cleared, sender kept; for another member’s message (a group admin’s delete), moderationStatus is "removed" and its content and sender are cleared. Every loaded copy is updated, including one quoted inside another message. See Deleted and removed messages.
Requires ChatProvider in the component tree.

Usage Example

Parameters

The hook returns a function. That function accepts:
string
required
The ID of the conversation that contains the message.
string
required
The ID of the message to delete.

Returns

Promise<void>

Notes

  • Other participants see it in real time through the message:deleted or message:removed socket event, which ChatProvider handles automatically, and their local copy becomes the same placeholder.
  • For integration guidance, see Chat: Messages.