Tired of manually approving LinkedIn connection requests that don’t meet your criteria? Automate the process with Python. You’re probably spending hours sifting through new connection requests, checking profiles, and making decisions that could be done automatically. The more active your network, the more frustrating this becomes.

The Manual Way (And Why It Breaks)

Without automation, developers usually resort to manually reviewing each connection request and either accepting or declining one by one. This process is not only time-consuming but also prone to human error and inconsistency. You might miss key criteria or accidentally accept a request from someone outside your target audience. If you’re managing a large network, you quickly hit API limits from LinkedIn’s platform, and your productivity plummets. Spreadsheets and manual filtering can only take you so far before they become a bottleneck.

The Python Approach

Here’s a simple Python script that demonstrates how to automate filtering connection requests based on profile information. It reads from a CSV file, applies a set of rules, and produces a list of accepted connections.

import csv

def load_contacts(filename):
    with open(filename, 'r') as f:
        reader = csv.DictReader(f)
        return list(reader)

def apply_rules(contact, rules):
    for key, value in rules.items():
        if key in contact and contact[key] != value:
            return False
    return True

def filter_connections(contacts, rules):
    accepted = []
    for contact in contacts:
        if apply_rules(contact, rules):
            accepted.append(contact)
    return accepted

# Example usage
contacts = load_contacts('contacts.csv')
rules = {'industry': 'Technology', 'connections': '500+'}
accepted = filter_connections(contacts, rules)

print("Accepted connections:", len(accepted))

This code loads contact data from a CSV, applies basic filtering rules, and returns a list of contacts that match those criteria. It works well for small datasets but lacks error handling, doesn’t support advanced rules, and doesn’t generate message templates or export plans. For bigger use cases, it becomes unwieldy and hard to maintain.

What the Full Tool Handles

The Professional Network Automation Rule Builder improves on this basic approach in several ways:

  • Multiple input formats: Accepts CSV, JSON, and other exported data types.
  • Advanced rule logic: Supports conditions like “not in”, “contains”, “greater than”, etc.
  • Error handling and logging: Gracefully handles missing or malformed data.
  • CLI interface: Easy command-line usage with flags for input, rules, and output.
  • Export capabilities: Generates action plans in JSON or standard automation formats for third-party tools.

Running It

You can run the tool directly from the command line like this:

python linkedin_rules.py --input contacts.csv --rules rules.json --output automation_plan.json
  • --input: Path to your exported CSV or JSON file.
  • --rules: JSON file defining your connection acceptance criteria.
  • --output: Path to save the resulting automation plan.

The output is a structured JSON file that outlines which connections to accept, what messages to send, and when to take action. It’s ready to be imported into tools like Automator, Zapier, or even custom scripts.

Results

You save hours each week by automating repetitive connection decisions. The tool generates clean, actionable output that can be used by other automation platforms or integrated into your own workflows. It solves the problem of inconsistent filtering and manual effort without you having to write or maintain code.

Get the Script

If you want to skip the build and get a polished solution, try the Professional Network Automation Rule Builder. It’s a one-time purchase at $29 and works across Windows, Mac, and Linux.

Download Professional Network Automation Rule Builder →

$29 one-time. No subscription. Works on Windows, Mac, and Linux.

Built by OddShop — Python automation tools for developers and businesses.