Before you go, check out these stories!

Hackernoon logoModify and Reply To Deleted WhatsApp Texts [A How-To Guide] by@zer0k

Modify and Reply To Deleted WhatsApp Texts [A How-To Guide]

Author profile picture

@zer0kAakash Khatu

Computer engineering student that likes to learn stuff.

A while back I was playing around with a chrome extension that allows you to restore deleted messages on WhatsApp web.

How it does that is:

  • Stores all messages it receives locally.
  • When a message gets deleted, it adds the previously known message contents to a deleted messages array.
  • Then it replaces the โ€œThis message was deleted โ€ text with its previous contents.

Once the message gets restored you can even quote it in a reply.

While sending the reply message to WhatsApp, along with your message, you are also expected to send all the data of the message that you are quoting, this is what I make use of.

Now before sending the reply I can edit the contents of the deleted message to be whatever I want.

Since the message is deleted, WhatsApp doesnโ€™t check if the data that I sent is valid or not and forwards the same data to everyone else.

Using this on non deleted messages only edits the message for you.

How would this beย useful

Just imagine the things you can make your friends (or enemies) say!

Honestly,I cannot find a better use for this other than using it as a topic for my first blog post.

Try Itย Yourself

  • Open WhatsApp Web.
  • Press
    to open up the console for Google Chrome.
  • Paste the code from the gist into the console (After reading it, and making sure that it wonโ€™t make you order 100 toasters from amazon).
    Here is the link to the Gist on GitHub which has all the required helper functions.
  • Then open up a chat and Ctrl - Click on the area beside the deleted message.
  • Fill out the message prompts to write your own reply message, and the Quoted message.

The helper functions are taken directly from the Chrome extension WA Web Plus. They expose the underlying WhatsApp webโ€™s java-script function to allow us to use them in our script. Sadly, the code from the extension is obfuscated and difficult to read.

Read the contents of

function ayo(x)
to understand the workings of getting the message id, editing the message, and sending it.

function ayo(x) {
    if ( === x.currentTarget) {
        d = this;
        // gets the id of the selected message and stores it in variable c
        for (i in d) i.startsWith("__reactInternalInstance$") && (c = d[i]["return"]["return"].key);
        var b = $(this);
        if (x.ctrlKey) {
            a = prompt("Enter Your Reply", "Reply text");
            var text = prompt("Enter the Quoted Text", "deleted message text");
            c = void 0 !== c ? c.replace("msg-", "") : "";
            b && (b = window.f.Chat.where({
                __x_active: !0
            }), c = window.f.Msg.get(c), b[0].sendMessage = b[0].sendMessage ? b[0].sendMessage : function () {
                return window.f.sendMessage.apply(this,
            }, void 0 !== c && ((c.__x_type = "chat", c.__x_body = text, c.__x_text = text), c.__x_isRevoked = !1), b[0].sendMessage(a, {
                quotedMsg: c
            return !1

$(document).on("click", ".message-in", ayo)

You can do a lot more fun stuff with the WhatsApp Webโ€™s java-script functions, like automatic replies to messages, making self destructing messages, adding quick replies, etc.

Hope that you have fun with this, this is my first Article so help me out if I've made any mistakes.

Author profile picture

@zer0kAakash Khatu

Read my stories

Computer engineering student that likes to learn stuff.


Join Hacker Noon

Create your free account to unlock your custom reading experience.