Bulk withdrawal LinkedIn old pending invitation

UPD 11/19/2020: Due to changes in interface previous version doesn’t works properly, so had to update code, with delay 1 second for each withdrawal.

At some moment amount of pending invitations becomes too huge. That causes problems with sending new invites. So you have to withdraw some of them that are too old.

You can do i manually, but that takes too long even, when you have to withdraw 50 invitations but at some moment I had 3500+ of them.

As an SEO specialist, I used many bookmarklets (bookmarks that contain a snippet of JavaScript). So I decided to do my bookmarklet that will click the withdraw button and then confirm.

Updated script takes all withdrawal buttons, click on them with 1 second delay from end of the page to the start. With little delay clicks on the confirmation button. After all invitations on the page withdrawn it starts from the end till the moment when there would be no pending invitations from after current page. The script:

    var i = document.querySelectorAll("button[data-control-name=withdraw_single]").length - 1; //set index to the last withdraw button on page
var interval = setInterval( //set interval for repeat function till the end of pending invitations
    function() {
        if (location.search.match(/page=/)) { //check that we werent redirected to the first page of pending requests
            document.querySelectorAll("button[data-control-name=withdraw_single]")[i].click(); //click on withdraw button
            i = ((i < 1 || i > document.querySelectorAll("button[data-control-name=withdraw_single]").length - 1) ? document.querySelectorAll("button[data-control-name=withdraw_single]").length - 1 : i - 1); //decrement index or if it reached 0 restart from the end
            document.querySelector(".artdeco-button--primary").click(); //click on confirmation button
        } else {
            clearInterval(interval); //in case when we were redirected to the first page stop end interval
    }, 1000); //interval set to 1000 ms (1 seconds)

The same but in one line:

javascript:var i = document.querySelectorAll("button[data-control-name=withdraw_single]").length-1; var interval = setInterval(function() {if (location.search.match(/page=/)) {document.querySelectorAll("button[data-control-name=withdraw_single]")[i].click();i = ((i<1||i>document.querySelectorAll("button[data-control-name=withdraw_single]").length-1)?document.querySelectorAll("button[data-control-name=withdraw_single]").length-1:i-1);document.querySelector(".artdeco-button--primary").click();} else {clearInterval(interval)}},1000);

You can add this code to a bookmark, to do that:

  • In Chrome, click Bookmarks->Bookmark Manager.
  • You should see a new tab with the bookmarks and folders listed.
  • Select the “Bookmarks Tab” folder on the left.
  • Click the “Organize” link, then “Add Page” in the dropdown.
  • You should see two input fields. Type the name of the bookmark you would like (i.e., WithdrawPendingLinkedIn) in the first field.
  • Paste the javascript code upper into the second field.

Or try to right-click on WithdrawPendingLinkedIn and select add to bookmarks on most Chrome versions that don’t work.

Then go to the page from what you need to clear like https://www.linkedin.com/mynetwork/invitation-manager/sent/?invitationType=CONNECTION&page=9, run that bookmark, enjoy!