Because who doesn't have an inbox full of "I got a new phone", event-based group chats, and old lingering messages in their Facebook Messages?
Surprisingly, Facebook has not implemented a way to archive many messages in your inbox. This script provides that solution.
Load Facebook Messages in a new tab.
Open the JavaScript console and paste the contents of jquery.min.js into the console.
Paste the contents of archive-all-facebook-messages.js
into the console.
If you want to only test the results before actually running the archiving, there's a param for that:
archive_all(testOnly=true);
When you're ready to run for real:
archive_all();
- Currently only detects the list of messages visible to the user in the page. You can work around this by repeatedly scrolling the message list pane to the bottom until all messages are loaded. I plan to automate this step soon.
- There is no way to whitelist certain messages from being archived. Currently, you can manually unarchive select messages from the archived view.
- Sometimes the messages page remains cached after the script reloads it. Reloading it once by hand solves this.
Thank you so much! I just had 100 Marketplace conversations and this saved me so much time. Also, for easier usage, just drag the code to the bookmarks and then just click it when you need it. It looks like you would need to add javasript tag to the front before it'll work. At least for me on Brave. It would look like so:
javascript: (() => {
(function run(){let all=document.querySelectorAll('div[aria-label="Menu"]');if(all.length==0)return;let a=all[1];a.click();let menuitems=document.querySelectorAll('div[role=menuitem]');let archiveChatRegex=/Archive chat/;for(let i=0;i<menuitems.length;i++){if(archiveChatRegex.test(menuitems[i].innerText)){menuitems[i].click();}}requestAnimationFrame(run);})();
})();
Drag all of that code to your bookmark toolbar and it'll put it there. Then, you can use it whenever you like.