2 min read

In this article I will show you how to automatically delete all messages, at once and without installing any plugin.

Facebook Messenger

Whatever the reason could be, in this way you will have the cleanest Messenger chats ever.

Free your mind from the clutter. Offline life is better.

Disclaimers

Disclaimer: It is needed a simple and short script which you should want to understand before running it, because it has the power to mess up with your Facebook account.

Disclaimer: Follow the steps at your own risk. I am not responsible for what your are doing. Are you?

Getting Started

There are three simple steps in between you and the clarity of your Facebook Messenger chats. There is a short script involved, which you will copy and paste into the console of the Developer tools of your browser (Firefox, Chrome) while navigating into the Facebook Messenger page.

In Short, what you will be doing:

  1. Get the script.
  2. Go to the Facebook Messenger.
  3. Run the script within the browser.

1. Get the script

Copy in your clipboard the code of the most recent version of the script from github, or try your luck with this one:

var pleaseRemoveDiscussionPlease = function () {

    var clickElement = function(elem) {
        elem.style.border = "thick solid red";
        elem.click();
    }

    var confirmDeleteDiscussion = function(idx) {
        [...document.querySelectorAll('div[role="dialog"] button')].forEach( (a) => { 
            if (a.innerHTML === "Delete") {
                clickElement(a);
            }
        });
        setTimeout(removeDiscussion, 5000, idx);
    }
    
    var deleteDiscussion = function(idx) {
        [...document.querySelectorAll('li[role="presentation"] > a[role="menuitem"] > span > span')].forEach( (a) => { 
            if (a.innerHTML === "Delete") { 
                clickElement(a);
            }
        });
        setTimeout(confirmDeleteDiscussion, 2000, idx);
    }

    var removeDiscussion = function() {
    
        var elem = [...document.querySelectorAll('div[aria-label="Actions"] > div > div[aria-label="Conversation actions"]')][0];
        if (elem) {
            clickElement(elem);
            setTimeout(deleteDiscussion, 600);
        } else {
            clearTimeout();
            console.log('DONE. Now drop a message to somebody on Signal and have a walk together.');
        }  
    };  
  
    removeDiscussion();
}

2. Go to the Facebook Messenger

  1. Go to the Facebook Messenger page.
  2. Scroll down entirely until all of your chats are visible in the left column.

3. Run the script within the browser

  1. Press F12 to open the Developer tools window (Firefox, Chrome).
  2. Select Console.
  3. Read the security concerns message that the Facebook developers left for you.
  4. Paste the script into the prompt of the console
  5. Type pleaseRemoveDiscussionPlease(), hit return, and wait until it’s done.



If this article was useful to you, please share it using your favorite way for doing it! If you have suggestions of improvement or you’ve found something wrong, please let me know!


You are not being tracked on this website, no analytics, no cookies taken. I am still looking for a good plugin for comments which respects people's privacy. This website is hosted by Gitlab Pages which as far as stated by their general GitLab's privacy policy terms they collects potentially personally-identifying information like Internet Protocol (IP) addresses as mentioned in this thread.