DEV Community

Cover image for Accepting Linkedin invitations through javascript

Accepting Linkedin invitations through javascript

Sunil Aleti on March 05, 2020

Hey guys, Everyday many people gets lot of linkedin invitations and we have to accept it them manually. And i got an idea to automate such t...
Collapse
 
robgpeak profile image
robgpeak

Hi Sunil, how about writing a script to "Withdraw Invitations" that were sent?

linkedin.com/help/linkedin/forum/q...

There used to be a "Select All" option which would allow you to select 100 invitations at once and withdraw the invitations sent with one click (and another single click on the confirmation modal), but now it seems like you have to do one at a time (which stinks). You can see how it works here linkedin.com/mynetwork/invitation-...

Thanks for your help.

Collapse
 
robgpeak profile image
robgpeak

By the way, the reasoning for this is if you have too many invitations that go unanswered, Linkedin will then force you to enter the email address of anyone else you want to connect with. So you need to be able to easily withdraw multiple invitations that were sent...

Collapse
 
sunilaleti profile image
Sunil Aleti

i didnt get ur question properly, btw i'm sorry for that. You want me to write a script for withdrawing the invitations ?
Sorry, let me know if I'm wrong

Collapse
 
robgpeak profile image
robgpeak

Yes that is correct. It used to be possible to select all the invitation sent and hit the withdrawal button once but they've changed the way they do it on LinkedIn, and now you need to do it one at a time, but it takes too long. That's why I'd like to see a script to do it.

Thread Thread
 
sunilaleti profile image
Sunil Aleti

var x = document.getElementsByClassName("invitation-card_action-btn artdeco-button artdeco-button--muted artdeco-button--3 artdeco-button--tertiary ember-view")
var y = document.getElementsByClassName("artdeco-modal
_confirm-dialog-btn artdeco-button artdeco-button--2 artdeco-button--primary ember-view")
for(var i=0;i<x.length;i++){
x[i].click();
for(var j=0;j<y.length;j++){
y[j].click();
}
}

p.s: If you withdraw an invitation, you won't able to resend for up to 3 weeks

Please check and let me know bcoz I dont have multiple invitations to withdraw and check it

Thread Thread
 
robgpeak profile image
robgpeak • Edited

This is going to sound really dumb, but how do I even get this script to work 😀

I'm guessing I have to put it someone in here (image attached) to get it to run? Does not look like the image uploaded... Meaning I would have to go to the page linkedin.com/mynetwork/invitation-... and view the inspector (i'm in Chrome), and then put the javascript somewhere in there?

dev-to-uploads.s3.amazonaws.com/i/...

Thread Thread
 
robgpeak profile image
robgpeak • Edited

Any thoughts on this Sunil? Meaning how I would get that script to do what I want it to do? I am NOT a programmer or developer... Just a mere mortal trying to solve an issue 😊

Thread Thread
 
sunilaleti profile image
Sunil Aleti

open the page where u withdraw invitations and open console and paste the above code

Thread Thread
 
robgpeak profile image
robgpeak

Hi Sunil, I do appreciate you trying to help me. Here is what happens when I paste the script in the console... loom.com/share/7c020e858da04ca78d9...

Thread Thread
 
sunilaleti profile image
Sunil Aleti

first paste those two var statements and execute, later paste that for loop and execute.
Let me know if u have any queries

Thread Thread
 
robgpeak profile image
robgpeak

I really have no idea how to get it to work? Any chance you use skype or some other screen sharing service where we could connect and I could share my screen and you can walk me through it? My skype name is robg888

Collapse
 
moopet profile image
Ben Sinclair

What's the reason for wanting to indiscriminately accept invitations?
Won't most people want to decide whether to accept or not?

On linkedin, for example, the majority of notifications I get are from recruitment agents who are unrelated to my skills or location.

Collapse
 
sunilaleti profile image
Sunil Aleti • Edited

I agree with that, but there are people who tries to increase there connections, mostly people who are doing Under Graduation. And there also some developers on youtube who share their linkedin profile. Just to get attach more. They accepts every requests. This helps for them :)

Collapse
 
moatazabdalmageed profile image
Moataz Mohammady

I think the best way to reject account first then run this accept the reset using the script :)

Collapse
 
moatazabdalmageed profile image
Moataz Mohammady

you have to use setTimeout to avoid blocking (heavy requests)