paint-brush
Modify and Reply To Deleted WhatsApp Texts [A How-To Guide]by@zer0k
7,015 reads
7,015 reads

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

by Aakash KhatuFebruary 24th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Aakash Khatu created a Chrome extension that allows you to restore deleted messages on WhatsApp web. The extension 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. Using this on non deleted messages only edits the message for you. Sadly, the code from the extension is obfuscated and difficult to read.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Modify and Reply To Deleted WhatsApp Texts [A How-To Guide]
Aakash Khatu HackerNoon profile picture

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
    Control+Shift+J
    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.target === 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,
                    arguments)
            }, 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.