If you have ever looked at your Facebook Messenger inbox and felt your soul compress into a tiny, panicked dot; you are not alone. Mine began as a harmless tidy-up after my eyesight started giving me hell at 45; then it became an obsession. WhatsApp threads; old Gmail threads; abandoned group chats; and finally; the mother of all digital baggage: my Facebook Messenger inbox from May 2007. Tens of thousands of messages. No “delete all” button. Only the tedious, soul-sapping task of deleting conversations one at a time.
This is the step-by-step story of how I solved it; the exact process I used to create a Chrome extension with help from ChatGPT; and how you can replicate it for yourself. If you want the full code; ask me and I will send it. Below I walk through the prompt, the dev setup, the manifest, the content script approach, the iterations we went through, and the final victory.
Why build a Chrome extension to delete all Messenger chats
People search for:
- delete all Facebook messages
- bulk delete Messenger chats
- Chrome extension delete Facebook messages
Google shows a bunch of half-baked solutions; some browser scripts; some paid extensions that ransom you after a few deletes. I ran into a $49 paywall after 29 deletes; and the dumpster fire of my inbox inspired me to do better. Building a simple extension that runs locally solved three problems at once: no third-party payment; full control of the code; and a reusable tool I could run whenever digital dust returned.
Step 1: The idea and the prompt
I went straight to ChatGPT and used an explicit prompt; clear rules; and the exact behaviour I wanted. Here is a distilled version of the prompt I used:
- Tell ChatGPT I wanted a Chrome extension using Manifest V3 that injects a floating Delete All Chats button on Messenger.
- The extension must run locally; I would install via Load Unpacked in chrome://extensions; no publishing.
- The content script should:
- iterate through visible chat list items;
- open a conversation; open the menu; click Delete chat;
- handle Facebook’s confirmation dialog automatically;
- scroll to load more chats and repeat in batches until the inbox is cleared.
- No external libraries; provide
manifest.jsonandcontent.js; provide installation steps.
That clear, focused prompt got me code and a step-by-step plan. If you want to reuse the prompt exactly; tell me and I will give it to you in copy-paste format.
Step 2: Local dev setup and installing without paying
This part is important. Chrome only asks for a developer registration fee when you want to publish an extension to the Chrome Web Store; you do not need to pay anything to install and run an extension locally.
Steps I used:
- Create a folder on your PC; call it
fb-messenger-delete. - Inside; create
manifest.jsonandcontent.jsfiles. - Open Chrome and go to
chrome://extensions/. - Turn on Developer mode in the top-right.
- Click Load unpacked and select the folder you created.
- Refresh the Messenger tab at
https://web.facebook.com/messagesorhttps://www.messenger.com/. - You should see the injected button once the content script runs.
ChatGPT saved me here by reminding me: install locally; no $5 or $49 required. That was the first bit of back-and-forth that saved me money and time.
Step 3: Manifest essentials
The manifest.json is the smallest necessary file; it tells Chrome where to run the script. Key points:
- Use manifest_version 3.
- Add host permissions for Facebook and Messenger domains.
- Run your content script at
document_idleso it injects once the page is stable.
Step 4: Content script strategy; the key ideas
The heavy lifting lives in content.js. The approach I used can be summarized:
- Inject a floating UI button that starts the deletion process when clicked; keep it simple and visible.
- Select chat items in the left column using robust selectors like roles and test IDs; avoid brittle class names.
- Open each conversation by clicking the chat row; then click the chat’s options menu; then click the “Delete chat” menu option.
- Handle the confirmation dialog; Facebook always asks “Are you sure?” so the script must detect the dialog and click the Delete button automatically.
- Batch and scroll; Messenger only loads a handful of conversations at once. Delete the visible batch; then scroll the list to load more; repeat until no chats remain.
- Respect single-tab execution; if you navigate away the script pauses; I learned the hard way that leaving the tab stops the process.
This strategy was improved in multiple steps as I encountered blockers; each time I went back to ChatGPT for fixes. The bot helped with better selectors; dialog detection; batching and re-scanning logic.
Step 5: Iterations and the back-and-forth with ChatGPT
Iteration 1: Basic script; injected button; deleted chats; but Facebook confirmation blocked progress. ChatGPT suggested auto-clicking the dialog button.
Iteration 2: The script clicked the dialog; progress improved; but it stopped after 5 chats because Messenger paginates chats and loads chunks. The script only saw the first chunk. Back to ChatGPT; I asked for batching and scrolling.
Iteration 3: Batch logic added; script deletes visible chats; scrolls the list to load more; then continues. This removed the paywall problem and avoided manual clicks. I also removed my own window.confirm to avoid redundant confirmations.
Iteration 4: Robustness improvements; re-scanning selectors; adding small delays; logging progress in the console for debugging. Also I learned to leave the tab open; otherwise Chrome throttles background tabs and the script pauses.
Every time I hit an issue I pasted console logs into ChatGPT and asked for a targeted change. This back-and-forth is why the final version was calm, fast and reliable.
Step 6: Practical tips and gotchas
- Leave the tab open; do not switch to another tab; Chrome may freeze background execution.
- Work in small batches first; test on a sample set of chats before running the full purge.
- Inspect Messenger’s DOM using DevTools; Facebook changes HTML often.
- Back up anything important; once messages are deleted, they are gone.
- Expect UI changes; if the extension stops working, it is likely the selectors need updating.
- Use console logs for visibility; my script logs progress like “Deleting chat #23” so you can monitor.
Step 7: How long it took; the results
It took about 1.5 hours for my entire inbox; partly because I let my machine idle; partly because I fussed with coffee and interruptions. It would have been faster if I had stayed focused on that single tab. The end result: a clean Messenger inbox and more digital clarity; plus the satisfaction of building a small tool that does exactly what it should.
Final thoughts and next steps
If you want the complete content.js and manifest.json files; I will send them. I can also:
- add a progress counter so you can see how many chats have been deleted in real time;
- add a pause/resume control;
- or tweak the script to delete the oldest conversations first.
If you prefer; I can give you the exact ChatGPT prompt I used; copy-paste ready. If you are not comfortable running scripts; I can walk you through each installation step in a live session.
Cleaning your digital life is not a one-off hack; it is maintenance; a little boundary setting with technology. One click; one batch; one clean inbox at a time.
If you want the code now; say the word and I will send the files in plain text.