Deleting and Recalling Messages
mesibo offers a rich set of APIs for deleting, wiping, recalling or editing messages. These APIs can be utilized in various ways depending on your app logic, for example:
- Invoking the delete or wipe message API when a user taps to remove a message.
- Leveraging the message retraction APIs when a user wants to retract or modify a sent message.
- Sending disappearing messages that will be deleted after set intervals.
- Scheduling regular cleanup on app start by wiping old, unwanted messages that are no longer relevant.
- Deleting messages when user is blocked or unmatched.
There are different types of deletion:
- Deleting individual or multiple messages by message ID.
- Deleting messages for a particular user or group.
- Deleting messages older than a specified time.
- Wiping messages instead of deleting.
You can delete an individual message by calling
wipe() API of the message.
You can wipe and mark the message as deleted instead of deleting by calling:
You can delete multiple messages at once by calling one of the following APIs:
// Delete specific message IDs
// Delete messages older than timestamp (milliseconds)
// Delete messages older than duration (seconds)
|message IDs to be deleted
|Delete messages older than this timestamp (milliseconds)
|Delete messages older than this duration (seconds)
You can also delete messages for a specific user or group using the
// Delete all messages
// Delete messages older than timestamp
// Delete messages older than duration
duration parameters work the same as above.
When you delete all messages of a user or a group messages using
deleteMessages(), that user or group will no longer appear in the message summary. If you are not familiar with message summary, please refer to
reading messages, the message summary is the last message from all the users sorted by the timestamp.
If you want the user or group to still show up in the summary, use
clearMessages() instead. This deletes all messages like
deleteMessages(), but additionally reserves an empty message that will be returned in the summary.
// Clear messages and keep user/group in summary
// Clear with custom timestamp
The reserved empty message has a default timestamp to maintain position. But you can specify a custom timestamp:
|Keep original timestamp
|Set max timestamp to move to top
|Set min timestamp to move to bottom
|Set custom timestamp (truncated between min/max)
The reserved empty message has the status field set to
MESIBO_MSGSTATUS_EMPTY which you can use to identify this special empty message.