LinkedIn: How to Auto-Accept Invites!

Did you put yourself on TopLinked.com and now you’re swamped receiving up to 50 invites a day (350 invites a week), needing to click “Accept” for every single one?

I will show you how to easily automate the process of accepting invites with a TamperMonkey script.

Just add this script to TamperMonkey, make sure TamperMonkey is enabled, and point your browser at:

https://www.linkedin.com/inbox/#invitations .

The script will then kick in, and click accept for every invite, on that page, reload to find more, click accept for each of those, reload, and repeat as necessary!

// ==UserScript==
// @name       Auto-Accept Invites from the LinkedIn Inbox
// @namespace  https://cabalistix.com/linkedin-auto-accepting-invites/
// @version    0.5
// @description  No more need to click accept for every LinkedIn invite.
// @match      https://www.linkedin.com/inbox/*
// @copyright  2014 Cabalistix.com
// ==/UserScript==

function AcceptInvitesOnPage () {
    var MINIMUM_TIME_BETWEEN_INVITE_ACCEPT_CLICKS = 12000;
    var RANDOM_TIME_MAX = 5000;

    var i=0;

    if ($('a[data-action="invitationAccept"][data-action-url^="/inbox/action"]').length) {
		console.log('Found invites to accept');
        
        $('a[data-action="invitationAccept"][data-action-url^="/inbox/action"]').each(function( index ) {
            var dataActionUrl = $(this).attr('data-action-url');

            if (dataActionUrl !== undefined) {
                var randomAdjust = Math.floor((Math.random() * RANDOM_TIME_MAX) );

                setTimeout(function(dataActionUrl) {
						console.log('Clicking accept');                
                        $('a[data-action="invitationAccept"][data-action-url="'+dataActionUrl+'"]')[0].click();
                    }, (i*MINIMUM_TIME_BETWEEN_INVITE_ACCEPT_CLICKS + randomAdjust), dataActionUrl);
            } else {
                console.log('No accept button for this person.');
            }

            i++;
        });

        setTimeout(function() {
				console.log('Reloading to find new accepts');
                location.reload(true);
            }, (i*MINIMUM_TIME_BETWEEN_INVITE_ACCEPT_CLICKS));    
    } else {
		console.log('No invites to accept');
    }
}

$(document).ready(function() {
    if (window.location.hash) {
        var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
        
        // Only do this on the #invitations view
        // As in https://www.linkedin.com/inbox/#invitations
        if (hash.indexOf("invitations") == 0) {
            var script = document.createElement("script"); script.src = "https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.10.2.min.js"; document.body.appendChild(script);
            
            // Delay initial processing since the content takes time to load.
            setTimeout(AcceptInvitesOnPage,25000);
            
            // After the initial processing do it every 10 minutes.
            setInterval(AcceptInvitesOnPage,600000);
        }
    } else {
    }
});

3 comments

  1. K.C. · July 15, 2014

    Thank you so much for this – worked like a charm.

  2. Sebastian · July 15, 2014

    You rock! I had 1800+ pending invitations because I didn’t want to accept them all manually, now I don’t anymore! Thank you so much! 😀

  3. PANKIL · July 15, 2014

    Wonderful……its really helping a lot.

Comments are closed.