Last active
July 10, 2025 22:40
-
-
Save willianpinho/696d35cb2476c10be7a65e4c9ec5b307 to your computer and use it in GitHub Desktop.
LinkedIn Auto Connector with Custom Message: This script automates the process of sending LinkedIn connection requests with a personalized message. It works by scanning all visible “Connect” buttons on the current page, clicking each one, selecting “Add a note”, inserting a predefined message, and clicking “Send”. The script tracks the number of…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async function autoConnectLinkedIn() { | |
const message = `Your Information`; | |
let totalConnections = 0; | |
const delay = (ms) => new Promise(res => setTimeout(res, ms)); | |
function showSystemNotification(title, body) { | |
if (Notification.permission === "granted") { | |
new Notification(title, { body }); | |
} else if (Notification.permission !== "denied") { | |
Notification.requestPermission().then(permission => { | |
if (permission === "granted") { | |
new Notification(title, { body }); | |
} | |
}); | |
} | |
} | |
function hasReachedWeeklyLimit() { | |
return [...document.querySelectorAll('*')] | |
.some(el => el.textContent.includes("You’ve reached the weekly invitation limit")); | |
} | |
async function clickConnectButtons() { | |
const connectButtons = Array.from(document.querySelectorAll('button')) | |
.filter(btn => btn.innerText.trim() === "Connect"); | |
for (const btn of connectButtons) { | |
btn.scrollIntoView({ behavior: "smooth" }); | |
await delay(1000); | |
btn.click(); | |
await delay(2000); | |
if (hasReachedWeeklyLimit()) return false; | |
const addNoteButton = [...document.querySelectorAll('button')] | |
.find(b => b.innerText.trim().toLowerCase() === 'add a note'); | |
if (addNoteButton) { | |
addNoteButton.click(); | |
await delay(1000); | |
const textarea = document.querySelector('textarea[name="message"]'); | |
if (textarea) { | |
textarea.value = message; | |
textarea.dispatchEvent(new Event('input', { bubbles: true })); | |
const sendButton = [...document.querySelectorAll('button')] | |
.find(b => b.innerText.trim().toLowerCase() === 'send'); | |
if (sendButton) { | |
sendButton.click(); | |
await delay(2500); | |
// Only count if no weekly limit popup appears after sending | |
if (hasReachedWeeklyLimit()) return false; | |
totalConnections++; | |
} | |
} | |
} else { | |
const sendButton = [...document.querySelectorAll('button')] | |
.find(b => b.innerText.trim().toLowerCase() === 'send'); | |
if (sendButton) { | |
sendButton.click(); | |
await delay(2500); | |
if (hasReachedWeeklyLimit()) return false; | |
totalConnections++; | |
} | |
} | |
if (hasReachedWeeklyLimit()) return false; | |
} | |
return true; | |
} | |
async function goToNextPage() { | |
const nextButton = [...document.querySelectorAll('button, a')] | |
.find(el => el.innerText.trim().toLowerCase() === 'next'); | |
if (nextButton) { | |
nextButton.click(); | |
await delay(4000); | |
return true; | |
} | |
return false; | |
} | |
while (true) { | |
const canContinue = await clickConnectButtons(); | |
if (!canContinue) break; | |
const hasNext = await goToNextPage(); | |
if (!hasNext) break; | |
} | |
showSystemNotification("LinkedIn Auto Connector", `Process finished. Total connections sent: ${totalConnections}`); | |
console.log(`Finished. Total connections sent: ${totalConnections}`); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment