Skip to content

Instantly share code, notes, and snippets.

@abhishekdubey1
Last active April 13, 2021 01:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhishekdubey1/0419674fbe42db0ecfb39879806f93b7 to your computer and use it in GitHub Desktop.
Save abhishekdubey1/0419674fbe42db0ecfb39879806f93b7 to your computer and use it in GitHub Desktop.
Scroll down to comments to see how to use this code snippet
function manageRequests(acceptAll, ignoreAll, acceptCount){
let invitationsList = document.getElementsByClassName('mn-invitation-list')[0]
let requests = invitationsList.querySelectorAll('li')
let lengthOfRequests = requests.length
function alertUser(fnCall, count){
alert(`Hey User, you are about to ${fnCall} - ${count} connection requests`)
}
function handleRequests(num, count) {
for(let i=0; i<count; i++) {
requests[i].querySelector('.invitation-card__action-container').querySelectorAll('button')[num].click()
}
}
if(acceptAll){
handleRequests(1, lengthOfRequests); alertUser("ACCEPT", lengthOfRequests)
} else if(ignoreAll){
handleRequests(0, lengthOfRequests); alertUser("IGNORE", lengthOfRequests)
} else if(acceptCount) {
let count = parseInt(acceptCount.split('-')[1], 10) || 10;
if(acceptCount[0] === "a"){
handleRequests(1, count); alertUser("ACCEPT", count)
} else {
handleRequests(0, count); alertUser("IGNORE", count)
}
}
}
@abhishekdubey1
Copy link
Author

abhishekdubey1 commented Mar 12, 2021

manageRequests is function you have to run everytime to use this code snippet on Linkedin

To use this code go to Linkedin then Right click then console and then copy paste the code snippet given above then copy paste function examples below to manage your connection requests

  1. manageRequests(true, false)
    Accepts 100 requests at max, caution: doing this can lead to hit api limit, so 10-20 requests at a time is advised

  2. manageRequests(false, true)
    Ignores 100 requests at max, caution: doing this can lead to hit api limit, so 10-20 requests at a time is advised

  3. manageRequests(false, false, "a-10")
    Accepts 10 requests

  4. manageRequests(false, false, "i-10")
    Ignores 10 requests

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