AI Integration Quick Reference
AI Integration Quick Reference
deletedAt (timestamp), deletedBy (user who deleted)- Adding a listener to receive real-time message deletes when your app is running.
- Calling a method to retrieve missed message delete events when your app was not running.
Delete a Message
In other words, as a sender, how do I delete a message? UsedeleteMessage() with the message ID of the message to be deleted.
- Delete Message
Response
Response
On Success — A
BaseMessage object with deletedAt and deletedBy fields set:BaseMessage Object:sender Object:receiver Object:Error
Error
deletedAt (timestamp) and deletedBy (UID of deleter) fields set.
Relevant fields to access on the returned message:
By default, CometChat allows certain roles to delete a message.
Real-time Message Delete Events
In other words, as a recipient, how do I know when someone deletes a message when my app is running? UseonMessageDeleted in MessageListener to receive real-time delete events.
- Dart
onMessageDeleted callback receives a BaseMessage object with the deletedAt and deletedBy fields set.
Relevant fields to access on the returned message:
Missed Message Delete Events
In other words, as a recipient, how do I know if someone deleted a message when my app was not running? When you retrieve the list of previous messages, for the messages that were deleted, thedeletedAt and the deletedBy fields will be set. Also, for example, if the total number of messages for a conversation are 100, and the message with message ID 50 was deleted. Now the message with ID 50 will have the deletedAt and the deletedBy fields set whenever it is pulled from the history. Also, the 101st message will be an Action message informing you that the message with ID 50 has been deleted.
For the message deleted event, in the Action object received, the following fields can help you get the relevant information-
action-deletedactionOn- Updated message object which was deleted.actionBy- User object containing the details of the user who has deleted the message.actionFor- 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 delete a message.
Next Steps
Edit Message
Modify sent messages before deletion
Send Message
Send text, media, and custom messages
Receive Messages
Handle incoming messages in real-time
Flag a Message
Report inappropriate messages