Skip to content

Instantly share code, notes, and snippets.

@programmerdave
Last active December 15, 2025 15:30
Show Gist options
  • Select an option

  • Save programmerdave/238f083cc6ca9e6fe89748fe6339c199 to your computer and use it in GitHub Desktop.

Select an option

Save programmerdave/238f083cc6ca9e6fe89748fe6339c199 to your computer and use it in GitHub Desktop.
Remove all saved messages from your saved view in Slack
// Remove all saved messages from your saved view in Slack
// Open Slack in a web browser and log in
// Go to your Saved/Later messages screen
// Click on either In Progress, Archived, or Completed for the list you want to delete.
// F12 to raise dev console
// Paste the below
// Wait a while till it does its thing. If you need to stop it, close the tab.
(async function(x) {
let moreActionsSelector = 'div.p-saved_for_later_page__list_wrapper button[aria-label="More actions"]';
let modalRemoveFromLaterSelector = 'div.ReactModal__Content--after-open button.c-menu_item__button--danger[id^="menu-"][id$="4"]';
let maxRetries = 3;
let retryCounter = 0;
while (true)
{
let e = document.querySelector(moreActionsSelector);
if (e == null)
{
if (retryCounter == maxRetries) {
break;
}
await new Promise(resolve => setTimeout(resolve, 1000)) //wait some more time for the page to load just in case
console.log("Retrying after 500ms to find More Actions > Remove from Later buttons! Retry Number " + (retryCounter+1));
retryCounter++;
continue;
}
retryCounter = 0; //reset this after we find more items
e.click();
await new Promise(resolve => setTimeout(resolve, 100))
let modalButton = document.querySelector(modalRemoveFromLaterSelector);
if (modalButton && modalButton.children.length != 0 && modalButton.children[0] && modalButton.children[0].innerText == "Remove from Later")
{
console.log("Clicked Remove from Later");
modalButton.click();
}
else
{
console.log("Could not find the Remove from Later button! Stopping execution of script.");
break;
}
await new Promise(resolve => setTimeout(resolve, 400))
}
console.log("Finished finding all More Actions > Remove from Later buttons!");
})();
@programmerdave
Copy link
Author

Inspiration from this other gist which lets you delete your Slack drafts: https://gist.github.com/ScottMaclure/80adda47040b039965248289c37cfe8b

@Shikkic
Copy link

Shikkic commented Apr 4, 2025

We're in 2025 and still have this problem 😆 drafted this version for messages that were deleted but still saved for some reason...
https://gist.github.com/Shikkic/89414b26da97930bd3e0e43d377ef95b

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