Delete Messages

Delete message is a feature that is found in modern messaging apps that 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.

caution

If DeleteMessage feature is unavailable for your plan, then it will throw 403 exception

Note: The messages will not be deleted from the recipient.

await SDK.deleteMessagesForMe(`TO_JID`, `MESSAGE_IDS`);

Delete for Everyone#

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

caution

If DeleteMessage feature is unavailable for your plan, then it will throw 403 exception

await SDK.deleteMessagesForEveryone(`TO_JID`, `MESSAGE_IDS`);

Method Params#

StatusDescriptionTypeRequired
TO_JIDJID of the To User/GroupJID Stringtrue
MESSAGE_IDSArray of To Message IdsArraytrue

Clear Chat Messages#

The clear chat message is a feature that allows users to delete chat messages.

If you want to clear the messages for the entire chat, or multiple chats then you can utilize the below methods.

Clear Chat#

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

caution

If Clear Chat feature is unavailable for your plan, then it will throw 403 exception

await SDK.clearChat(`TO_JID`, `FAVOURITES`, `LAST_MSG_ID`);

Method Params#

StatusDescriptionTypeRequired
TO_JIDJID of the To User/GroupJID Stringtrue
FAVOURITESWhether to Delete Favourites Messages or notBooleanfalse
LAST_MSG_IDlastMsgId which the message is sendStringfalse

Delete Chat#

You can delete the chat (from recent chat) by using the below method.

caution

If Delete Chat feature is unavailable for your plan, then it will throw 403 exception

await SDK.deleteChat(`TO_JID`, `FAVOURITES`);

Method Params#

StatusDescriptionTypeRequired
TO_JIDJID of the To User/GroupJID Stringtrue
FAVOURITESWhether to Delete Favourites Messages or notBooleanfalse

Clear All Chat#

You can clear all conversation by using the below method.

await SDK.clearAllChat();