Skip to content

Instantly share code, notes, and snippets.

@noncent
Last active June 4, 2023 10:58
Show Gist options
  • Save noncent/94c6e3787eab45ebafe1ca0d0fd5b386 to your computer and use it in GitHub Desktop.
Save noncent/94c6e3787eab45ebafe1ca0d0fd5b386 to your computer and use it in GitHub Desktop.
Delete LinkedIn messages automatically in one go.
Hello everyone!
Some time ago, I was attempting to tidy up my LinkedIn account by removing unnecessary clutter.
I decided to begin by deleting all of the old messages, followed by the notifications. However,
I soon discovered that I had to manually click and delete each notification individually,
as there was no option to select and delete them in bulk. This process was quite surprising and time-consuming.
To address this issue, I created a script that automates the deletion process for you.
The script is designed to be executed in the console panel of your web browser and is written in plain JavaScript.
Its purpose is to delete old notifications, messages, and archives,
making the clean-up process much more efficient.
### Updated code 4 June 2023, works for below pages.
1 - https://www.linkedin.com/notifications/
2 - https://www.linkedin.com/messaging/thread/new/
```javascript
setInterval(() => document.querySelectorAll('[type="trash"]').forEach((x) => x.click()), 3000);
```
IMPORTANT!!
--------------------------------------------------------
### Please do not use the below code, won't work
--------------------------------------------------------
```javascript
/**
* Warning - this script is made for education purpose only and must be run, executed on your own risk.
* Author is not responsible for anything.
*
* Delete all your old notifications from Linkedin
*
* Step 1 - open link https://www.linkedin.com/notifications/
* Step 2 - open browsers console panel by right click and inspect
* Step 3 - go to console tab and paste script
*/
[...document.querySelectorAll('[type="trash-icon"]')].map(x => x.click());
/**
* Warning - this script is made for education purpose only and must be run, executed on your own risk.
* Author is not responsible for anything.
*
* URL - https://www.linkedin.com/messaging/thread/new/
*
* Delete all your old & archive messages from Linkedin
*
* Step 1 - open link https://www.linkedin.com/messaging/thread/new/
* Step 2 - open browsers console panel by right click and inspect
* Step 3 - go to console tab and paste script
* Step 4 - Hit the enter and click yes when prompt for delete
*/
setInterval(function () {
[...document.querySelectorAll(".nt-card-settings-dropdown__trigger-icon .mercado-match")].map(
function (x) {
x.click();
setTimeout(function () {
[...document.querySelectorAll('[type="trash-icon"]')].map(a => a.click());
}, 1000);
})
}, 3000);
```
Cheers!!
Neeraj Singh
@bhaskar098
Copy link

Hi Neeraj,

the mentioned script is not working. Can you please look into it

@noncent
Copy link
Author

noncent commented Dec 8, 2021

Hi @bhaskar098 I have updated and tested the script which is running fine.

@gustavorobertux
Copy link

Works like a charm !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment