Skip to main content

Delete Messages

The IMKit chat UI by default supports long-press to delete messages, allowing you to either delete a single local message or synchronize the deletion of both local and remote messages.

You can modify the behavior of the delete button in the IMKit chat UI's long-press menu. For details, see Chat UI.

If IMKit's existing implementation doesn't meet your requirements, you can directly use the following capabilities provided by IMLib:

  • Delete a specific local message (by Message ID)
  • Delete all local history messages in a conversation
  • Delete specified messages (Message Object) in a conversation
  • Delete conversation history messages (by timestamp), with options to delete locally only or both locally and from the server
  • Delete conversation history messages (by timestamp) from the server only
tip

For core classes, APIs, and usage, refer to the IMLib documentation Delete Messages. Note: Methods in IMLib do not provide UI refresh capabilities. You'll need to implement custom notification mechanisms for UI refreshes based on your business requirements.