Reading Time: ~10 min
LinkedIn is the best platform for B2B lead generation. But doing everything manually — sending connection requests, following up, messaging hundreds of people — takes hours every week.
That’s why more and more marketers, founders, and sales teams are learning how to make your own LinkedIn automation instead of paying $100+/month for tools.
In this guide, you’ll learn exactly how to build your own LinkedIn automation from scratch — what tools to use, how to set it up safely, and how to avoid getting your account banned.

What Is LinkedIn Automation?
LinkedIn automation means using software to do repetitive tasks on LinkedIn automatically. This includes:
- Sending connection requests
- Sending follow-up messages
- Viewing profiles
- Endorsing skills
- Scraping lead data
Instead of clicking and typing all day, a script or bot does it for you in the background.
Why Build Your Own Instead of Using a Paid Tool?
Paid tools like Expandi, HeyReach, or Dux-Soup are great — but they cost money every month and give you limited control.
Building your own LinkedIn automation gives you:
- Full control over what the bot does
- No monthly fees after setup
- Custom logic based on your exact workflow
- Learning opportunity if you’re a developer or marketer who wants to understand how these tools work
What You Need Before You Start
You don’t need to be a professional developer. But you do need a basic understanding of Python and how browsers work.
Here’s what you need:
- A LinkedIn account (preferably a secondary/warm account to test with)
- Python 3.8+ installed on your computer
- Basic knowledge of running scripts in a terminal
- A code editor (VS Code is free and works great)
- An AI
The Two Main Approaches to LinkedIn Automation
1. Browser Automation (Selenium or Playwright)
This is the most popular method. Your script controls a real browser — Chrome or Firefox — and interacts with LinkedIn just like a human would.
Selenium is the most well-known tool and has the largest community. It’s been around for years and has tons of tutorials available.
Playwright is newer and built by Microsoft. It’s faster, more reliable, and better at handling modern web apps. Many developers now prefer it over Selenium.
Both tools are open source and free to use. You can find the official documentation here:
2. API-Based Automation
LinkedIn has an official API but it’s very limited for personal use. It mostly works for company pages and requires approval from LinkedIn.
Some developers use unofficial API methods by capturing browser network requests. This is more advanced and carries higher risk of account restrictions.
For most people, browser automation is the better starting point.
Step-by-Step: How to Make Your Own LinkedIn Automation with Python
Step 1: Install Python and the Required Libraries
First, make sure Python is installed. Then open your terminal and run:
pip install selenium playwright
For Playwright, you also need to install the browser:
playwright install chromium
Step 2: Set Up Your Browser Driver
For Selenium, you need ChromeDriver — a tool that lets Python control Chrome. You can use the webdriver-managerpackage to handle this automatically:
pip install webdriver-manager
Here’s a simple script to open LinkedIn:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get("https://www.linkedin.com")
Run this — it should open a Chrome window and go to LinkedIn.
Step 3: Log In to LinkedIn
Your bot needs to log in. Here’s how to do it with Selenium:
from selenium.webdriver.common.by import By
import time
driver.get("https://www.linkedin.com/login")
time.sleep(2)
# Enter your email
email_field = driver.find_element(By.ID, "username")
email_field.send_keys("[email protected]")
# Enter your password
password_field = driver.find_element(By.ID, "password")
password_field.send_keys("your-password")
# Click Sign In
driver.find_element(By.CSS_SELECTOR, "[data-litms-control-urn='login-submit']").click()
time.sleep(3)
Important: Never hardcode your real password in a script. Use environment variables or a
.envfile to keep your credentials safe.
Step 4: Add Delays and Human-Like Behavior
This is the most important step. LinkedIn’s anti-bot system detects automation through:
- Clicking too fast
- Too many actions in a short time
- Consistent timing patterns
Add random delays between actions:
import random
import time
def human_delay(min_sec=1.5, max_sec=4.0):
time.sleep(random.uniform(min_sec, max_sec))
Call human_delay() between every action in your script.
Step 5: Automate a Specific Action (Example: Send Connection Requests)
Here’s a basic example of searching for a profile type and sending connection requests:
# Navigate to LinkedIn search
driver.get("https://www.linkedin.com/search/results/people/?keywords=marketing+manager")
human_delay(2, 4)
# Find Connect buttons
connect_buttons = driver.find_elements(By.XPATH, "//button[contains(@aria-label, 'Connect')]")
for button in connect_buttons[:5]: # Limit to 5 per session
button.click()
human_delay(1, 3)
# Handle the "Add a note" popup
try:
send_btn = driver.find_element(By.XPATH, "//button[@aria-label='Send without a note']")
send_btn.click()
human_delay(2, 5)
except:
pass
Open-Source Projects to Build On
You don’t have to start from zero. Here are some solid open-source LinkedIn automation repositories on GitHub that you can study and modify:
- joshiayush/inb — a Python bot for automating LinkedIn tasks including connection requests
- BAHETIHARSH/automate-linkedin — clean Selenium-based LinkedIn automation scripts
- ManiMozaffar/linkedIn-scraper — a Playwright bot for scraping LinkedIn job and profile data
These projects are great for learning how others have solved common problems like handling CAPTCHAs, managing login state, and rotating through search results.
How to Use n8n for No-Code LinkedIn Automation
If you don’t want to write code at all, n8n is one of the best options. It’s an open-source workflow automation tool you can self-host or run in the cloud.
With n8n, you can build multi-step outreach workflows visually — connect LinkedIn actions to your CRM, email, or Slack. It’s not as flexible as raw Python scripts, but it’s much faster to set up.
Combined with tools like PhantomBuster (which handles the LinkedIn browser actions), you can build a full automated outreach pipeline with no code.
How to Stay Safe and Avoid Getting Banned
LinkedIn actively detects and bans automation. Here are the most important safety rules:
Set strict daily limits. LinkedIn experts recommend staying within these ranges to stay safe:
- Connection requests: 20–40 per day
- Profile views: 50–80 per day
- Messages: 20–30 per day
Use a warm account. Don’t automate a brand new account or your main personal account. Use an account that has been active for several months and has real connections.
Add randomness to everything. Vary delays, vary the time of day you run the bot, vary the number of actions per session.
Use residential proxies if scaling. According to BirdProxies, LinkedIn’s 2024-2025 updates introduced advanced browser fingerprinting that detects headless browsers — residential proxies are now the minimum requirement for any automation at scale.
Run in non-headless mode when testing. Headless browsers (invisible browsers) are easier for LinkedIn to detect. Use a visible browser window while you test.
Common Mistakes to Avoid
Running too many actions too fast is the #1 reason accounts get flagged. Always add delays.
Using the same message template for everyone triggers spam detection. Personalize messages even slightly.
Not handling pop-ups and modals will break your script. LinkedIn shows verification prompts, CAPTCHA challenges, and “Add a note” popups at random. Always add error handling.
Automating on a fresh account immediately gets it flagged. Build up the account organically for 4–8 weeks first.
FAQ: How to Make Your Own LinkedIn Automation
Is LinkedIn automation legal?
LinkedIn’s Terms of Service prohibit automated access to the platform without permission. This means using automation tools technically violates their ToS and can get your account restricted or banned. It is not illegal under most laws, but it is a violation of platform rules. Use it at your own risk.
Do I need to know how to code to automate LinkedIn?
Basic Python knowledge is enough to get started with Selenium or Playwright. If you don’t want to code at all, tools like n8n combined with PhantomBuster let you build automation workflows visually.
What’s the safest way to automate LinkedIn?
Use a warmed-up secondary account, keep daily action limits low (under 40 connection requests per day), add randomized delays between every action, and avoid headless browser mode when possible.
Can I automate LinkedIn messages?
Yes. You can write a script that opens a conversation and types a message automatically. The same rules apply — keep volumes low and personalize messages to avoid spam detection.
How much does it cost to build your own LinkedIn automation?
If you build it yourself using Python, Selenium, and open-source tools, the cost is essentially zero beyond your own time. The only potential cost is a residential proxy service if you’re running the automation at scale.
What’s the difference between Selenium and Playwright for LinkedIn automation?
Both control a real browser and can interact with LinkedIn the same way. Playwright is newer, faster, and has better support for modern JavaScript-heavy websites. Selenium has a larger community and more existing tutorials. Either works for LinkedIn automation.
How many connection requests can I send per day safely?
Most practitioners recommend staying under 40 connection requests per day. Going over 100 per day significantly increases the risk of getting your account restricted by LinkedIn.
Final Thoughts
Learning how to make your own LinkedIn automation is not as hard as it looks. Start with a simple Python script using Selenium. Add proper delays. Keep your action limits low. Test on a secondary account before using it on your main profile.
If you want to scale further, explore open-source projects on GitHub, use n8n for workflow building, and consider proxies to protect your main account.
The biggest mistake people make is moving too fast — both in action speed and in trying to do too much too soon. Start slow, test carefully, and scale up only when you know the bot is working reliably.
Disclaimer: This article is for educational purposes. Automating LinkedIn may violate their Terms of Service. Always use automation responsibly and at your own risk.

