AI Integration Quick Reference
AI Integration Quick Reference
- Adding a listener for real-time edits when your app is running
- Fetching missed edits when your app was offline
Edit a Message
UseeditMessage() with a TextMessage or CustomMessage object. Set the message ID using the id property.
Add/Update Tags
Usetags to update tags when editing. New tags replace existing ones.
- Text Message
- Custom Message
editMessage().
- Dart
Response
Response
On Success — A
BaseMessage object containing all details of the edited message:BaseMessage Object:sender Object:receiver Object:Error
Error
editedAt (timestamp) and editedBy (UID of editor) fields set.
The editMessage() method returns a BaseMessage object (or a subclass like TextMessage).
Relevant fields to access on the returned message:
By default, CometChat allows certain roles to edit a message.
Real-time Message Edit Events
UseonMessageEdited in MessageListener to receive real-time edit events.
- Dart
onMessageEdited callback receives a BaseMessage object with the editedAt and editedBy fields set.
Relevant fields to access on the returned message:
Missed Message Edit Events
When fetching message history, edited messages haveeditedAt and editedBy fields set. Additionally, an Action message is created when a message is edited.
The Action object contains:
action—editedactionOn— Updated message object with the edited detailsactionBy— User object containing the details of the user who has edited the messageactionFor— User/group object having the details of the receiver to which the message was sent
You must be the message sender or a group admin/moderator to edit a message.
Next Steps
Delete Message
Learn how to delete messages from conversations
Send Message
Send text, media, and custom messages
Receive Messages
Handle incoming messages in real-time
Threaded Messages
Create and manage message threads