Skip to main content
Editing a message is straightforward. Receiving edit events has two parts:
  1. Adding a listener for real-time edits when your app is running
  2. Fetching missed edits when your app was offline

Edit a Message

Use CometChat.edit(message:) with a TextMessage or CustomMessage object. Set the message ID on the object before calling edit.
The edited message object is returned with editedAt (timestamp) and editedBy (UID of editor) fields set. The edit() method returns a BaseMessage object (or a subclass like TextMessage).

Add/Update Tags

Use tags to update tags when editing. New tags replace existing ones.
By default, CometChat allows certain users to edit a message:

Real-time Message Edit Events

The onMessageEdited callback receives a BaseMessage object with the editedAt and editedBy fields set.

Missed Message Edit Events

When fetching message history, edited messages have editedAt and editedBy fields set. Additionally, an Action message is added to history indicating the edit. The Action object contains:
  • actionedited
  • actionOn — Updated message object
  • actionBy — User who edited the message
  • actionFor — Receiver (User or Group)
You must be the message sender or a group admin/moderator to edit a message.

Next Steps

Delete a Message

Remove messages from conversations

Send Messages

Send text, media, and custom messages

Threaded Messages

Organize conversations with message threads

Receive Messages

Listen for incoming messages in real time