Delete Messages

Delete messsage is a feature which is found in modern messaging apps which allows the user to delete the message once it is sent.Once you sent the message, you can able to delete the messages by using built in sdk methods.

Delete for me#

If you want to delete the messages for yourself only then you can use the below method.

Note: The messages will not be deleted to the receipient.

ArgumentTypeDescription
TO_JIDStringjid of the chat user
MESSAGE_ID_LISTList<String>List of messageId to be deleted
DELETE_CHAT_TYPEString"chat" for single chat, "groupchat" for group chat
IS_MEDIA_DELETEbooltrue, if media file also to be deleted in the local storage
flyCallbackFlyResponsecallback to observe the action status
Mirrorfly.deleteMessagesForMe(jid: TO_JID,chatType: DELETE_CHAT_TYPE,messageIds: MESSAGE_ID_LIST, isMediaDelete: IS_MEDIA_DELETE, flyCallBack: (FlyResponse response) {
if(response.isSuccess){
}
});

Delete for everyone#

If you want to delete the messages for yourself and receiver then you can use the below method. The messages will also be deleted to the receipient.

ArgumentTypeDescription
TO_JIDStringjid of the chat user
MESSAGE_ID_LISTList<String>List of messageId to be deleted
DELETE_CHAT_TYPEString"chat" for single chat, "groupchat" for group chat
IS_MEDIA_DELETEbooltrue, if media file also to be deleted in the local storage
flyCallbackFlyResponsecallback to observe the action status
Mirrorfly.deleteMessagesForEveryone(jid: TO_JID,chatType: DELETE_CHAT_TYPE,messageIds: MESSAGE_ID_LIST, isMediaDelete: IS_MEDIA_DELETE, flyCallBack: (FlyResponse response) {
if(response.isSuccess){
}
});
caution

If delete message feature unavailable for your plan then it will throw 403 exception.

Clear chat messages#

Clear chat messages is a feature which allows users to delete the chat messages to reduce the storage usage. if you want to clear the messages for the entire chat, or multiple chats then you can utilise the below methods. it will also delete the downloaded media files from your local storage.

Clear chat#

You can clear the messages for any chat by using the below method. The messages will not be deleted to the receipient.

ArgumentTypeDescription
TO_JIDStringjid of the chat user
DELETE_CHAT_TYPEString"chat" for single chat, "groupchat" for group chat
CLEAR_EXCEPT_STARREDboolif true, delete all the messages except the favourite messages
flyCallbackFlyResponsecallback to observe the action status
Mirrorfly.clearChat(jid: TO_JID, chatType: CHAT_TYPE, clearExceptStarred: CLEAR_CHAT_EXCEPT_STARRED, flyCallBack: (FlyResponse response) {
if (response.isSuccess) {
}
});
caution

If clear chat feature unavailable for your plan then it will throw 403 exception.

Clear all conversation#

You can clear the messages of all chats including group by using the below method.

ArgumentTypeDescription
flyCallbackFlyResponsecallback to observe the action status
Mirrorfly.clearAllConversation(flyCallBack: (FlyResponse response) {
if(response.isSuccess){
}
});
caution

If delete chat feature unavailable for your plan then it will throw 403 exception.