Automate LinkedIn Profile Sourcing with n8n and GPT-4O-MINI

Discover how to automate sourcing LinkedIn profiles from job descriptions using n8n workflow with GPT-4O-MINI and Google Sheets integration. This automation converts natural language job inputs into Boolean search queries, scrapes Google search results, and compiles candidate URLs efficiently to save time and reduce manual errors.
chatTrigger
openAi
googleSheets
+5
Workflow Identifier: 1375
NODES in Use: chatTrigger, openAi, googleSheets, httpRequest, code, wait, if, stickyNote

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

1. Opening Problem Statement

Meet Sarah, a busy recruitment specialist at a tech firm. Every day, she spends hours manually searching for potential candidates on LinkedIn by trying to translate job descriptions into effective Boolean search strings on Google. This tedious task not only wastes Sarah’s precious time but also leads to inconsistent results and the risk of missing out on qualified candidates because of poorly formulated searches. On top of that, manually copying and managing candidate LinkedIn URLs into spreadsheets introduces the chance of errors and data loss, costing her team valuable recruiting efficiency.

This exact pain point is what the “TopSourcer – Finds LinkedIn Profiles using natural language” workflow is designed to solve. It automates the entire process from job description input to compiling qualified LinkedIn profile URLs into a Google Sheet spreadsheet, reducing hours of manual work into minutes with higher precision and repeatability.

2. What This Automation Does

This n8n workflow smartly connects several tools and nodes to convert natural language job descriptions into actionable LinkedIn candidate sourcing. Here’s what happens when it runs:

  • Receives a natural language job description from a chat message trigger designed to accept recruiter inputs in plain English.
  • Generates a custom Boolean search string tailored specifically for LinkedIn profile discovery using the GPT-4O-MINI OpenAI model, ensuring highly targeted search terms.
  • Creates a brand new Google Sheet named after the job search criteria plus the current date/time, acting as a dynamic repository for results.
  • Uses an authenticated Google Search to execute the Boolean search with pagination, pulling multiple pages of search results to maximize profile discovery.
  • Extracts LinkedIn profile URLs from raw HTML search result pages using JavaScript code nodes to parse and clean these URLs efficiently.
  • Appends these URLs into the Google Sheet in a structured, predefined column format for easy access and further action by recruiters.
  • Handles multiple pages automatically by incrementing the search start index using loop logic, delaying slightly between requests to avoid rate limiting.

Overall, this workflow saves Sarah significant manual effort—cutting down days of manual LinkedIn sourcing to an automated, bulletproof process that delivers consistent candidate lists every time.

3. Prerequisites ⚙️

  • n8n account to create and activate the workflow
  • OpenAI account with API key configured (GPT-4O-MINI model)
  • Google Sheets account with OAuth2 credentials connected
  • Authenticated Google Search using a valid Google cookie header string (used via Cookie-Editor browser extension for extraction)
  • Chrome browser with Cookie-Editor extension installed (for scraping authenticated Google searches)

4. Step-by-Step Guide

Step 1: Activate the Workflow and Read Initial Instructions

Open your n8n dashboard and activate this workflow named “TopSourcer – Finds LinkedIn Profiles using natural language.” You’ll notice sticky notes guiding you to paste job descriptions and configure API keys. This is where Sarah would start by clicking “Open Chat” to input her job criteria.

Step 2: Connect Your OpenAI API Key

Navigate to the “Generate a Boolean Search String” node (using the OpenAI GPT-4O-MINI model). Under credentials, add your OpenAI API key. You can find or create this key at OpenAI API Keys. This allows the node to generate precise Boolean search strings from your natural language input.

Step 3: Input Your Job Description into the Chat Trigger

The “When chat message received” node acts as your input. After workflow activation, click “Open Chat,” and paste or type the relevant job description or candidate profile you’re sourcing.

The workflow will automatically catch this message and proceed to generate the Boolean search string using GPT-4O-MINI.

Step 4: Understanding the Boolean Search String Generation

The “Generate a Boolean Search String” node sends your input to OpenAI with a specific prompt that instructs it to create a Boolean search string to find LinkedIn profiles matching the job. The response includes:

  • A Boolean string optimized with AND, OR, quotes, wildcards, and exclusions
  • A suggested ‘sheet_name’ that will be used to name your Google Sheet

Step 5: Create a New Google Sheet Named After Your Search

Next, the “Create a new sheet” node triggers, creating a new Google Spreadsheet using the sheet_name and current date/time. This is your dynamic candidates list workspace.

Step 6: Add Columns to the New Google Sheet

The “Columns to add” code node initializes the data structure with an empty ‘linkedin_url’ placeholder, then the “Add columns to new sheet” node appends the ‘linkedin_url’ column to the newly created sheet. This ensures the sheet is ready for data.

Step 7: Set Starting Page Number for Google Search

Use the “set page number for google search” code node to initialize the Google Search start parameter to zero. This marks the first page of Google results.

Step 8: Run Authenticated Google Boolean Search with Pagination

The “Google Boolean Search” HTTP request node performs the Google search with your Boolean string and the starting result index, using an authenticated Google cookie header for access.

This node sends a GET request to https://www.google.com/search with query parameters ‘q’ (search string) and ‘start’ (pagination index).

Important: The header uses your extracted cookie string to authenticate, preventing CAPTCHA and improving reliability.

Step 9: Extract LinkedIn Profile URLs from Search Results

The “Extracts all linkedin urls from the google http response” code node parses the raw HTML response:

// Extract LinkedIn profile URLs from HTML
function extractLinkedInUrls(html) {
    // decode entities & special chars
    html = html.replace(/&/g, '&')
               .replace(/\u003d/g, '=')
               .replace(/\x22/g, '"')
               .replace(/\x26/g, '&')
               .replace(/\x3e/g, '>')
               .replace(/\x3c/g, '<');

    const patterns = [
        /https?://(?:[a-z]{2,}.)?linkedin.com/in/[w._-]+(?:/[a-z]{2})?/gi,
        /("url"|url=)(?:[^"&]*?)https?://(?:[a-z]{2,}.)?linkedin.com/in/[w._-]+(?:/[a-z]{2})?/gi
    ];

    const urls = new Set();
    patterns.forEach(pattern => {
        for (const match of html.matchAll(pattern)) {
            let url = match[0].replace(/^"url"|^url=|"$/g, '').replace(/^["']|["']$/g, '').replace(/\+/g, '').trim();
            if (!url.startsWith('http')) url = 'https://' + url.replace(/^///, '');
            if (url.includes('linkedin.com/in/')) {
                url = url.split(/[?#&]/)[0].replace(//$/, '');
                urls.add(url);
            }
        }
    });
    return Array.from(urls);
}

const html = $input.first().json.data;
const linkedInProfiles = extractLinkedInUrls(html)
    .filter(url => !url.includes('google.com'))
    .map(url => ({ linkedin_url: url }));

return linkedInProfiles;

This script filters out duplicates, removes unnecessary URL parts, and prepares clean LinkedIn URLs in JSON for later processing.

Step 10: Append Extracted URLs to Your Google Sheet

“Appends the results to the sheet” Google Sheets node inserts these LinkedIn URLs into your designated columns in the previously created spreadsheet. It continuously adds as results are found from each page.

Step 11: Increment Search Start to Load Next Results Page

The “Adds 10 to start – Go to next page” code node increments the pagination index by 10 to fetch the next set of Google results on the following iteration.

Step 12: Loop Control to Stop After Desired Results

The “If desired results not reached” node checks if the current pagination index is less than 50 (default limit can be changed). If yes, it triggers a 5-second wait (in “Wait” node) to avoid Google rate-limiting, then restarts the search for the next page of results.

If the limit is reached, the workflow ends, having compiled enough candidate profile URLs.

5. Customizations ✏️

  • Change Result Limit: In the “If desired results not reached” node, adjust the threshold “50” to increase or decrease the total search results you want to collect.
  • Modify Boolean Search Prompt: Customize the system prompt in the “Generate a Boolean Search String” OpenAI node to target different social media sites or add keywords.
  • Expand Sheet Columns: Edit the “Appends the results to the sheet” node column mapping to include additional candidate details or other metadata.
  • Adjust Google Search Timing: Modify the “Wait” node duration to longer than 5 seconds if you encounter Google CAPTCHA or rate limits.

6. Troubleshooting 🔧

Problem: “HTTP 429 Too Many Requests” or search failing midway.
Cause: Rapid automated Google searches triggering rate limits.
Solution: Increase the wait time in the “Wait” node beyond 5 seconds and ensure your Google cookie header is valid and fresh.

Problem: “No LinkedIn URLs extracted” or empty results.
Cause: Search query malformed or Google results blocked.
Solution: Verify the Boolean search string generated in “Generate a Boolean Search String” node. Manually test the generated string on Google Search. Confirm authentication cookie is correctly set in “Google Boolean Search” node.

7. Pre-Production Checklist ✅

  • Confirm your OpenAI API key is valid and linked in the workflow.
  • Check your Google Sheets credentials are connected and have edit access to the target document.
  • Export a fresh Google cookie header using the Cookie-Editor extension and paste it into your HTTP header authentication node.
  • Run a test with a simple job description and watch the flow through each node for errors.
  • Verify the Google Sheet gets created and the “linkedin_url” column is appended correctly.

8. Deployment Guide

Once tested successfully, activate the workflow in your n8n environment. Keep the workflow active while sourcing candidates. Monitor your Google API usage and your OpenAI credits to avoid interruptions.

Optional: For better reliability, consider self-hosting n8n with a service like Hostinger (https://buldrr.com/hostinger) to keep your automation running continuously without depending on n8n cloud limitations.

9. FAQs

Can I use other AI models besides GPT-4O-MINI?
Yes, you can connect other OpenAI models or AI services in the “Generate a Boolean Search String” node with adjusted parameters as needed.

Is it safe to use my Google cookie header for automated searches?
While the header is extracted from your Google session, ensure you keep it private and refresh it regularly. Avoid sharing it publicly.

Does this automation consume a lot of OpenAI API credits?
The workflow uses minimal tokens since it only asks GPT to generate Boolean search strings, not full texts, keeping costs low.

10. Conclusion

By following this guide, you’ve set up a powerful n8n automation that transforms natural language job descriptions into smart LinkedIn profile sourcing — automatically generating Boolean search strings, scraping Google, and compiling candidate URLs in a Google Sheet.

This saves hours, reduces human error, and streamlines the tedious part of recruiting for Sarah and anyone else facing similar sourcing challenges. Next, you might want to enhance this workflow by adding LinkedIn profile enrichment, automated outreach sequences, or integrating with your ATS for seamless hiring pipelines.

Keep experimenting and improving to get the best out of your recruitment process with n8n automation!

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation in n8n (Beginner Guide)

A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free