AI Integration Quick Reference
AI Integration Quick Reference
deletedAt (timestamp), deletedBy (user who deleted)- Adding a listener for real-time deletes when your app is running
- Fetching missed deletes when your app was offline
Delete a Message
UseCometChat.delete(messageId:) with the message ID.
deletedAt (timestamp) and deletedBy (UID of deleter) fields set.
The delete() method returns a BaseMessage object.
This is a soft delete — message content is still available on the object. Check
deletedAt > 0 to identify deleted messages.| User | Conversation Type | Deletion Capabilities |
|---|---|---|
| Message Sender | One-on-one | Own messages only |
| Message Sender | Group | Own messages only |
| Group Admin | Group | All messages |
| Group Moderator | Group | All messages |
Real-time Message Delete Events
TheonMessageDeleted callback receives a BaseMessage object with the deletedAt and deletedBy fields set.
Missed Message Delete Events
When fetching message history, deleted messages havedeletedAt and deletedBy fields set. Additionally, an Action message is added to history indicating the deletion.
The Action object contains:
action—deletedactionOn— The deleted message objectactionBy— User who deleted the messageactionFor— Receiver (User or Group)
You must be the message sender or a group admin/moderator to delete a message.
Next Steps
Edit a Message
Edit sent messages in conversations
Send Messages
Send text, media, and custom messages
Receive Messages
Listen for incoming messages in real-time
Flag a Message
Report inappropriate messages