Trying to figure out a way to mass delete facebook messages any help appreciated. Thanks..
CodePudding user response:
So there is no clean way that I have found to do this, so I wrote something that works... USE AT YOUR OWN RISK!!!
I needed to mass delete old messages and this does the trick.
Go to messenger.com and login.
hit f12 to open dev tools.
Paste the following in your browser:
function getElementsByText(str, tag = 'a') {
return Array.prototype.slice.call(document.getElementsByTagName(tag)).filter(el => el.textContent.trim() === str.trim());
}
function doIt(){
getElementsByText = function getElementsByText(str, tag = 'a') {
return Array.prototype.slice.call(document.getElementsByTagName(tag)).filter(el => el.textContent.trim() === str.trim());
}
document.querySelectorAll('[aria-label="Menu"]')[0].click();
setTimeout(function(){
getElementsByText('Delete chat', 'div')[0].click();
},500);
setTimeout(function(){
this.getElementsByText('Delete chat', 'span')[2].click();
},1000);
}
Then paste this...
var myInt = setInterval(function(){ doIt() }, 500));
This will start running an interval and deleting messages, you can watch it in action!
If you want to stop, refresh the page or
clearInterval(doIt);