Tired of Clicking "Accept"? How to Safely Automate LinkedIn Invites (Without Getting Banned)
Why most console scripts get accounts restricted โ and a human-mimicking version that won't.
We've all been there: you open LinkedIn after a week away, and you're greeted by a mountain of pending connection requests. Clicking "Accept" dozens of times is a tedious chore.
Naturally, being the tech-savvy people we are, the first instinct is to find a quick JavaScript snippet to paste into the browser console to do the heavy lifting.
But here is a massive warning: most LinkedIn automation scripts you find online will get your account restricted or permanently banned.
Here is why those random scripts are dangerous, and how you can use a cleaned, "human-mimicking" version safely.
๐ The Hidden Danger of Basic Automation Scripts
If you grab a generic script off GitHub or StackOverflow, it usually works by finding every "Accept" button on the page and clicking them all at once using something called parallel execution (Promise.all).
To LinkedIn's security algorithms, this screams BOT. No human can click 10 buttons at the exact same millisecond. When LinkedIn catches this unnatural behavior, they put your account in "LinkedIn Jail" (temporary or permanent restriction).
๐งผ The Safe Solution: The "Human-Mimicking" Script
Here is a cleaned-up, safe version of the script. It processes invites sequentially, adds randomized delays between clicks, and includes a safety hard-stop so it won't loop infinitely if LinkedIn's code glitches.
(async function () {
console.log("๐ Starting safe LinkedIn request accept script...");
// Helper to pause execution
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
// Generates a random number between min and max (for chaotic human delays)
const rand = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
let totalAccepted = 0;
let cycle = 0;
const MAX_CYCLES = 10; // Safety guard to prevent infinite loops
while (cycle < MAX_CYCLES) {
cycle++;
console.log(`๐ Cycle ${cycle} of ${MAX_CYCLES}`);
// Find all Accept/Confirm buttons
const acceptButtons = Array.from(document.querySelectorAll('button'))
.filter(btn => {
const text = btn.innerText.trim().toLowerCase();
return text === 'accept' || text === 'confirm'; // Strict matching
});
console.log(`๐ Found ${acceptButtons.length} pending invites in this view.`);
if (acceptButtons.length === 0) {
// If no buttons found, try to load more content
const loadMoreBtn = Array.from(document.querySelectorAll('button'))
.find(btn => btn.innerText.trim().toLowerCase().includes('load more'));
if (loadMoreBtn) {
console.log("โฌ Clicking 'Load more'...");
loadMoreBtn.click();
// Wait a random 2-4 seconds for content to load
await sleep(rand(2000, 4000));
continue;
} else {
console.log("โ
No more invites or 'Load more' buttons found.");
break;
}
}
// Process buttons sequentially with human-like delays
for (const btn of acceptButtons) {
try {
// Scroll the button into view so it looks like a human is browsing
btn.scrollIntoView({ behavior: 'smooth', block: 'center' });
// Wait a moment after scrolling before clicking (1 to 2.5 seconds)
await sleep(rand(1000, 2500));
btn.click();
totalAccepted++;
console.log(`โ Accepted #${totalAccepted}`);
// Pause *after* the click before moving to the next one (1.5 to 3.5 seconds)
await sleep(rand(1500, 3500));
} catch (err) {
console.warn("โ Skipped a button due to an error:", err.message);
}
}
}
console.log(`๐ Script finished. Total accepted: ${totalAccepted}`);
})();
๐ How to Save This Permanently (No Copy-Pasting Every Time)
Instead of copying and pasting this code into the console every single time, you can save it as a Snippet right inside your browser's Developer Tools.
Step 1: Save the Snippet
- Go to your LinkedIn invitations page.
- Press F12 (or right-click and select Inspect) to open Developer Tools.
- Click on the Sources tab at the top.
- On the left navigation pane, look for the Snippets sub-tab (if you don't see it, click the double arrow
>>to reveal hidden tabs). - Click + New snippet, name it
LinkedIn_Accept, and paste the code above into the main window. - Press Ctrl + S (or Cmd + S on Mac) to save it.
Step 2: How to Run It
Whenever you land on your invite page in the future, just open your DevTools (F12), go to Sources > Snippets, right-click your LinkedIn_Accept snippet, and click Run.
You can sit back and watch the Console log your progress while the browser safely clears out your inbox!