AutomationFlowsAI & RAG › Scrape Linkedin Leads with Apify and Draft Gpt-4.1 Mini Gmail Cold Emails

Scrape Linkedin Leads with Apify and Draft Gpt-4.1 Mini Gmail Cold Emails

ByJitesh Dugar @jiteshdugar on n8n.io

This n8n workflow fully automates the outbound lead generation process using LinkedIn, Apify, OpenAI, Google Sheets, and Gmail.

Cron / scheduled trigger★★★★☆ complexityAI-powered15 nodesGmailGoogle SheetsOpenAI@Apify/N8N Nodes Apify
AI & RAG Trigger: Cron / scheduled Nodes: 15 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #15624 — we link there as the canonical source.

This workflow follows the Apifyn8N Nodes Apify → Google Sheets recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "lFgQX4uUnQUmumSBoRjsh",
  "meta": {
    "templateId": "10668",
    "templateCredsSetupCompleted": true
  },
  "name": "Scrape LinkedIn Leads",
  "tags": [],
  "nodes": [
    {
      "id": "36cecdd8-2fdb-4428-b6f3-8f627ed69453",
      "name": "Create a draft",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2080,
        112
      ],
      "parameters": {
        "message": "={{ $json.output[0].content[0].text.body }}",
        "options": {
          "sendTo": "={{ $('Filter').item.json.Email }}"
        },
        "subject": "={{ $json.output[0].content[0].text.subject }}",
        "resource": "draft",
        "emailType": "html"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b9588726-a802-4277-baf1-7ad233056b36",
      "name": "Store Leads",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        928,
        112
      ],
      "parameters": {
        "columns": {
          "value": {
            "About": "={{ $json.about }}",
            "Email": "={{ $json.emails[0].email }}",
            "Title": "={{ $json.headline }}",
            "Company": "={{ $json.companyWebsites[0].url }}",
            "Last Name": "={{ $json.lastName }}",
            "First Name": "={{ $json.firstName }}",
            "Email Score": "={{ $json.emails[0].qualityScore }}",
            "Deliverable?": "={{ $json.emails[0].deliverable }}",
            "Company LinkedIn": "={{ $json.currentPosition[0].companyLinkedinUrl }}",
            "LinkedIn Profile URL": "={{ $json.linkedinUrl }}"
          },
          "schema": [
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Deliverable?",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Deliverable?",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email Score",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email Score",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company LinkedIn",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company LinkedIn",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "LinkedIn Profile URL",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "LinkedIn Profile URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "About",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "About",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1hvdDDlEcgtD44WuNTYpwKyDn1W-Qg86yr4h9yUWBA20/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1hvdDDlEcgtD44WuNTYpwKyDn1W-Qg86yr4h9yUWBA20",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1hvdDDlEcgtD44WuNTYpwKyDn1W-Qg86yr4h9yUWBA20/edit?usp=drivesdk",
          "cachedResultName": "My LinkedIn Leads"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "1ddff140-a8c9-4a5c-9e4c-c36fe54c8dce",
      "name": "Draft Cold Email",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1616,
        112
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {
          "textFormat": {
            "textOptions": {
              "type": "json_object"
            }
          }
        },
        "responses": {
          "values": [
            {
              "content": "=Draft a high quality yet concise and plain text cold email to this user where we're asking if they want to get ahead in the AI race using AI Voice Agents. \n\nName: {{ $json['First Name'] }}\nHeadline: {{ $json.Title }}\nAbout: {{ $json.About }}\nCompany LinkedIn: {{ $json['Company LinkedIn'] }}\n\nOutput format should be strictly below JSON\n\n{\n\"subject\":\"<subject>\",\n\"body\":\"<html_email>\"\n}"
            },
            {
              "role": "system",
              "content": "You're a powerful cold email writer for a company ClareVoice that provides custom Voice AI Agents.\n\nYou specialize in writing cold emails with a high open and read rate. Your emails must not look AI generated and should be concise with a clear hook talking about their core problem, the subject line should drive curiosity. We need people to hit reply even if they're not interested.\n\nremember - email must be really concise, use pointers wherever possible.\n\nGenerate html email body.\n\nSignature should include\nJitesh Dugar\nFounder - ClareVoice"
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "f1086d40-1ec2-40f1-8eeb-fd871e239aa4",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        1296,
        112
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "36c91098-ed9c-4ffb-af25-8aff9a94abc7",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $json['Email Score'] }}",
              "rightValue": 70
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "4349eb69-2c9d-4690-a396-b4fc2da82d3d",
      "name": "Enrich Leads using LinkedIn URL",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        608,
        112
      ],
      "parameters": {
        "actorId": {
          "__rl": true,
          "mode": "list",
          "value": "LpVuK3Zozwuipa5bp",
          "cachedResultUrl": "https://console.apify.com/actors/LpVuK3Zozwuipa5bp/input",
          "cachedResultName": "LinkedIn Profile Scraper + Email \u2705 No Cookies (harvestapi/linkedin-profile-scraper)"
        },
        "operation": "Run actor and get dataset",
        "customBody": "={\n    \"profileScraperMode\": \"Profile details + email search ($10 per 1k)\",\n    \"queries\": [       \"{{ $json.linkedinUrl }}\"\n    ]\n}"
      },
      "credentials": {
        "apifyApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "15fa7c5a-757d-49cf-b1f8-d53dcebe41ba",
      "name": "Find LinkedIn Leads",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        288,
        112
      ],
      "parameters": {
        "actorId": {
          "__rl": true,
          "mode": "id",
          "value": "M2FMdjRVeF1HPGFcc"
        },
        "operation": "Run actor and get dataset",
        "customBody": "{\n    \"autoQuerySegmentation\": false,\n    \"locations\": [\n        \"New York\"\n    ],\n    \"maxItems\": 5,\n    \"profileScraperMode\": \"Full\",\n    \"recentlyChangedJobs\": false,\n    \"searchQuery\": \"CEO\",\n    \"yearsOfExperienceIds\": [\n        \"5\"\n    ]\n}"
      },
      "credentials": {
        "apifyApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1d780480-41f0-49c4-b6e1-681b67cda8c8",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -16,
        112
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 11,
              "triggerAtMinute": 6
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "4840fb34-a0e8-47ab-8345-442fd37f8886",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        -176
      ],
      "parameters": {
        "color": "#E1C1C1",
        "width": 304,
        "height": 416,
        "content": "# Step 1: Workflow Trigger\n\nThis Schedule Trigger starts the workflow at a fixed time.\n\nCurrent setup:\n- Runs daily at **11:06 AM**\n- No manual action is needed after the workflow is activated\n\nUse this node to control how often new LinkedIn leads should be collected."
      },
      "typeVersion": 1
    },
    {
      "id": "943bc94b-3d41-49a0-a5fe-f804746d95a6",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        -288
      ],
      "parameters": {
        "color": "#D2B1C3",
        "width": 288,
        "height": 528,
        "content": "# Step 2: Search LinkedIn Leads\n\nThis Apify node searches LinkedIn profiles using predefined targeting filters.\n\nCurrent search settings:\n- Role / Search Query: **CEO**\n- Location: **New York**\n- Max Results: **5**\n- Experience Filter: **5+ years**\n\nThe output includes LinkedIn profile data such as profile URL, name, headline, and other public profile details."
      },
      "typeVersion": 1
    },
    {
      "id": "25f2ff76-4e8b-4571-bf5e-e0cc2c011e45",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        -336
      ],
      "parameters": {
        "color": "#C9C0E2",
        "width": 304,
        "height": 576,
        "content": "# Step 3: Enrich LinkedIn Profiles\n\nThis Apify node takes each LinkedIn profile URL from the previous step and enriches the lead with additional profile and email data.\n\nIt attempts to collect:\n- Verified or discovered email address\n- Email deliverability status\n- Email quality score\n- Company website\n- Company LinkedIn URL\n- Job headline\n- About section\n\nThis step is important because the AI email needs enough context to write a personalized message."
      },
      "typeVersion": 1
    },
    {
      "id": "42dd1366-40b4-468c-b4d6-d791a3ff2e22",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        -352
      ],
      "parameters": {
        "color": "#BAD2D8",
        "width": 352,
        "height": 592,
        "content": "# Step 4: Save Leads into Google Sheets\n\nThis Google Sheets node appends each enriched lead into the selected spreadsheet.\n\nStored fields include:\n- First Name\n- Last Name\n- Email\n- Deliverability Status\n- Email Score\n- LinkedIn Profile URL\n- Company Website\n- Company LinkedIn URL\n- Job Title\n- About Section\n\nThe sheet acts as a simple CRM and tracking database for all collected leads."
      },
      "typeVersion": 1
    },
    {
      "id": "46109e12-ccb5-43aa-9be7-924ac469aac6",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        -240
      ],
      "parameters": {
        "color": "#C8E5A4",
        "width": 336,
        "height": 480,
        "content": "# Step 5: Filter High-Quality Emails\n\nThis Filter node allows only leads with a strong email quality score to continue.\n\nCurrent condition:\n- Email Score must be **greater than or equal to 70**\n\nLeads below this score are stopped here and will not be sent to the AI email generation step.\n\nThis helps reduce low-quality outreach, possible bounces, and poor sender reputation."
      },
      "typeVersion": 1
    },
    {
      "id": "43c636e4-6f13-4d05-82c4-0d9611a8c60b",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1552,
        -320
      ],
      "parameters": {
        "color": "#DEDBC0",
        "width": 400,
        "height": 560,
        "content": "# Step 6: Generate Personalized AI Cold Emails\n\nThis OpenAI node uses GPT-4.1 Mini to generate a personalized cold email for each qualified lead.\n\nThe AI uses lead context such as:\n- First name\n- Job title\n- About section\n- Company LinkedIn URL\n\nExpected AI output:\n- Email subject line\n- HTML email body"
      },
      "typeVersion": 1
    },
    {
      "id": "3ad12b91-61c3-4a9c-aaab-8b6b82d5458f",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1968,
        -288
      ],
      "parameters": {
        "color": "#DDBEA2",
        "width": 368,
        "height": 528,
        "content": "# Step 7: Create Gmail Draft Automatically\n\nThis Gmail node creates a draft email using the AI-generated subject and HTML body.\n\nThe recipient email is taken from the qualified lead data.\n\nImportant:\n- This node creates a draft only\n- It does not send the email automatically\n- A human can review, edit, and approve the message before sending\n\nThis makes the workflow safer for cold outreach because every email can be checked before it reaches the prospect."
      },
      "typeVersion": 1
    },
    {
      "id": "df908db1-4da5-4e59-b3c6-55e1f0f83261",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        -528
      ],
      "parameters": {
        "color": "#E1DFA8",
        "width": 736,
        "height": 208,
        "content": "# Workflow Overview\n\nThis workflow automates the lead generation and cold email preparation process.\n\nIt searches LinkedIn for targeted leads, enriches each profile with email and company data, stores the leads in Google Sheets, filters only high-quality email addresses, and uses AI to create personalized Gmail drafts.\n\nThe workflow does **not send emails automatically**. It creates review-ready drafts so a human can check the message before sending."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "9775be1e-0b14-47ba-9470-6925590c7e6c",
  "connections": {
    "Filter": {
      "main": [
        [
          {
            "node": "Draft Cold Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Leads": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Draft Cold Email": {
      "main": [
        [
          {
            "node": "Create a draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Find LinkedIn Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find LinkedIn Leads": {
      "main": [
        [
          {
            "node": "Enrich Leads using LinkedIn URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enrich Leads using LinkedIn URL": {
      "main": [
        [
          {
            "node": "Store Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n workflow fully automates the outbound lead generation process using LinkedIn, Apify, OpenAI, Google Sheets, and Gmail.

Source: https://n8n.io/workflows/15624/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow enables the automatic and regular tracking of competitors' Instagram Reels, providing rich insights for each video (summary, topic, hook, angles, tags, etc) through ChatGPT, and storing

Google Sheets, Telegram, @Apify/N8N Nodes Apify +1
AI & RAG

Personalized Outreach & Follow-Up - Phase 2. Uses googleSheets, openAi, gmail, gmailTrigger. Scheduled trigger; 59 nodes.

Google Sheets, OpenAI, Gmail +2
AI & RAG

This advanced workflow automates brand monitoring and media coverage tracking for musicians, bands, and music labels. The system uses multiple search queries (dorky) to discover mentions across the we

Google Sheets, Gmail, @Brave/N8N Nodes Brave Search +1
AI & RAG

Stop wasting billable hours on manual time-tracking. AutoTimesheet Pro uses AI to collect emails, meetings, and GitHub work, then writes a clean timesheet straight into Google Sheets. Perfect for deve

Google Calendar, Gmail, GitHub +3
AI & RAG

This workflow finds local business leads on Google Maps, enriches them with website and AI analysis, and sends personalized cold emails to qualified prospects automatically.

@Decodo/N8N Nodes Decodo, Google Sheets, OpenAI +1