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.

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

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

Method Params#

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

Response Format#

{
statusCode: "", // Number - status code
message: "", // String - Success/Error Message
}
note

To learn more about deleteMessagesForMe call back, go to messageListener Section.

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.

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

Method Params#

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

Response Format#

{
statusCode: "", // Number - status code
message: "", // String - Success/Error Message
}
note

To learn more about deleteMessagesForEveryone call back, go to messageListener Section.

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.

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

Method Params#

StatusDescriptionTypeRequired
TO_JIDJID of the To User/GroupJID Stringtrue
LAST_MSG_IDlastMsgId which the message is sendStringfalse

Response Format#

{
statusCode: "", // Number - status code
message: "", // String - Success/Error Message
}

Delete Chat#

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

await SDK.deleteChat(`TO_JID`);

Method Params#

StatusDescriptionTypeRequired
TO_JIDJID of the To User/GroupJID Stringtrue

Response Format#

{
statusCode: "", // Number - status code
message: "", // String - Success/Error Message
}