AutomationFlowsAI & RAG › Lead Generation - Find Businesses & Send Outreach

Lead Generation - Find Businesses & Send Outreach

Lead Generation - Find Businesses & Send Outreach. Uses httpRequest, openAi, googleSheets, emailSend. Event-driven trigger; 12 nodes.

Event trigger★★★★☆ complexityAI-powered12 nodesHTTP RequestOpenAIGoogle SheetsEmail Send
AI & RAG Trigger: Event Nodes: 12 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Emailsend → 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
{
  "nodes": [
    {
      "parameters": {},
      "id": "050cec61-9dda-4274-81b9-3c750a9628a9",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        464,
        -96
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "bb465312-0521-4727-ae79-8b7d7d7e3cff",
      "name": "Configuration",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.3,
      "position": [
        688,
        -96
      ],
      "notesInFlow": true,
      "notes": "Configure your search query, name, email, and portfolio URL here"
    },
    {
      "parameters": {
        "url": "https://serpapi.com/search.json",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "={{ $json.searchQuery }}"
            },
            {
              "name": "location",
              "value": "United Kingdom"
            },
            {
              "name": "num",
              "value": "={{ $json.maxResults }}"
            },
            {
              "name": "api_key",
              "value": "YOUR_SERPAPI_KEY"
            }
          ]
        },
        "options": {}
      },
      "id": "c594b659-ab08-47f9-9826-c01667a536c3",
      "name": "Search Google (SerpAPI)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        912,
        -96
      ],
      "notesInFlow": true,
      "notes": "Get free API key at serpapi.com (100 free searches/month)"
    },
    {
      "parameters": {
        "jsCode": "// Extract business results from SerpAPI response\nconst results = $input.first().json.organic_results || [];\nconst config = $('Configuration').first().json;\n\nconst businesses = results.map(result => ({\n  businessName: result.title || 'Unknown',\n  website: result.link || '',\n  snippet: result.snippet || '',\n  position: result.position,\n  yourName: config.yourName,\n  yourEmail: config.yourEmail,\n  yourWebsite: config.yourWebsite,\n  searchQuery: config.searchQuery\n})).filter(b => b.website && !b.website.includes('facebook.com') && !b.website.includes('yelp.com') && !b.website.includes('linkedin.com'));\n\nreturn businesses.map(b => ({ json: b }));"
      },
      "id": "c8460681-90bc-4380-97af-2fd7309c36ae",
      "name": "Extract Businesses",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1136,
        -96
      ]
    },
    {
      "parameters": {
        "url": "={{ $json.website }}",
        "options": {
          "redirect": {
            "redirect": {
              "maxRedirects": 3
            }
          },
          "timeout": 10000
        }
      },
      "id": "b772891e-fa48-4cb5-a017-f1a8e3b9abaa",
      "name": "Fetch Website",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        1360,
        -96
      ],
      "notesInFlow": true,
      "onError": "continueRegularOutput",
      "notes": "Fetches the website HTML to analyze"
    },
    {
      "parameters": {
        "jsCode": "// Extract basic info from website HTML\nconst html = $input.first().json.data || '';\nconst prevData = $input.first().json;\n\n// Try to find email in HTML\nconst emailRegex = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}/g;\nconst emails = html.match(emailRegex) || [];\nconst businessEmail = emails.find(e => !e.includes('example') && !e.includes('email@')) || '';\n\n// Check for outdated indicators\nconst outdatedIndicators = [\n  html.includes('Copyright 2019') || html.includes('Copyright 2020') || html.includes('Copyright 2021'),\n  html.includes('wordpress') && !html.includes('theme-2024'),\n  !html.includes('viewport'),\n  html.includes('flash') || html.includes('Flash'),\n  html.length < 10000, // Very simple site\n];\n\nconst outdatedScore = outdatedIndicators.filter(Boolean).length;\nconst isOutdated = outdatedScore >= 2 || html.length < 15000;\n\n// Extract title\nconst titleMatch = html.match(/<title>([^<]*)<\\/title>/i);\nconst pageTitle = titleMatch ? titleMatch[1].trim() : prevData.businessName;\n\nreturn [{\n  json: {\n    ...prevData,\n    businessEmail: businessEmail,\n    pageTitle: pageTitle,\n    isOutdated: isOutdated,\n    outdatedScore: outdatedScore,\n    websiteSize: html.length,\n    foundEmails: emails.slice(0, 3)\n  }\n}];"
      },
      "id": "fd34b1ea-b6d3-48bb-9533-90e66dbaad25",
      "name": "Analyze Website",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1584,
        -96
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "condition-outdated",
              "leftValue": "={{ $json.isOutdated }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "equals"
              }
            },
            {
              "id": "condition-email",
              "leftValue": "={{ $json.businessEmail }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "523b344a-a5dd-4ba7-955b-6d97ae029a8b",
      "name": "Filter Good Leads",
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2,
      "position": [
        1808,
        -96
      ],
      "notesInFlow": true,
      "notes": "Only keeps outdated websites with email found"
    },
    {
      "parameters": {
        "modelId": {
          "value": "gpt-4.1-nano",
          "mode": "list"
        },
        "messages": {
          "values": [
            {
              "content": "=You are an expert cold email copywriter. Write a short, personalized cold email to offer web design and n8n automation services.\n\nContext:\n- Business: {{ $json.pageTitle }}\n- Their website: {{ $json.website }}\n- What they do (from Google): {{ $json.snippet }}\n- Sender name: {{ $json.yourName }}\n- Sender portfolio: {{ $json.yourWebsite }}\n\nWrite a brief, friendly email that:\n1. Mentions something specific about their business\n2. Points out their website could use a modern refresh (be tactful)\n3. Offers web design AND automation services\n4. Keeps it under 150 words\n5. Ends with a soft CTA (reply or book a call)\n\nFormat:\nSubject: [subject line]\n\n[email body]\n\n[signature with name only]"
            }
          ]
        },
        "options": {
          "maxTokens": 500,
          "temperature": 0.7
        }
      },
      "id": "724691c1-13f1-4d6f-98b9-1886d48db3a5",
      "name": "Generate Personalized Email",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        2032,
        -96
      ],
      "notesInFlow": true,
      "notes": "Uses AI to write personalized outreach email"
    },
    {
      "parameters": {
        "jsCode": "// Parse the AI response into subject and body\nconst aiResponse = $input.first().json.message?.content || $input.first().json.text || '';\nconst prevData = $('Filter Good Leads').first().json;\n\n// Extract subject line\nconst subjectMatch = aiResponse.match(/Subject:\\s*(.+?)\\n/i);\nconst subject = subjectMatch ? subjectMatch[1].trim() : `Quick question about ${prevData.pageTitle}`;\n\n// Extract body (everything after Subject line)\nconst bodyStart = aiResponse.indexOf('\\n', aiResponse.indexOf('Subject:'));\nconst body = bodyStart > 0 ? aiResponse.substring(bodyStart).trim() : aiResponse;\n\nreturn [{\n  json: {\n    ...prevData,\n    emailSubject: subject,\n    emailBody: body,\n    generatedAt: new Date().toISOString()\n  }\n}];"
      },
      "id": "71dbad1d-c54d-4bc2-8507-307fe001b66c",
      "name": "Parse Email Content",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2384,
        -96
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "id": "c1bc6af4-afb5-47de-bff3-b278cbd7d89a",
      "name": "Add to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.3,
      "position": [
        2608,
        -192
      ],
      "notesInFlow": true,
      "notes": "Saves lead + generated email to your spreadsheet"
    },
    {
      "parameters": {
        "subject": "={{ $json.emailSubject }}",
        "options": {}
      },
      "id": "3300d71f-c0fd-4a37-bf42-00e74a15c69a",
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        2608,
        0
      ],
      "notesInFlow": true,
      "notes": "Configure your SMTP credentials in n8n"
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "1727d1c4-23a9-4aa4-81b0-cdb3ba89d2e7",
      "name": "Done",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.3,
      "position": [
        2832,
        0
      ]
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configuration": {
      "main": [
        [
          {
            "node": "Search Google (SerpAPI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Google (SerpAPI)": {
      "main": [
        [
          {
            "node": "Extract Businesses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Businesses": {
      "main": [
        [
          {
            "node": "Fetch Website",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Website": {
      "main": [
        [
          {
            "node": "Analyze Website",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Website": {
      "main": [
        [
          {
            "node": "Filter Good Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Good Leads": {
      "main": [
        [
          {
            "node": "Generate Personalized Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Personalized Email": {
      "main": [
        [
          {
            "node": "Parse Email Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Email Content": {
      "main": [
        [
          {
            "node": "Add to Google Sheets",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Email": {
      "main": [
        [
          {
            "node": "Done",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

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

About this workflow

Lead Generation - Find Businesses & Send Outreach. Uses httpRequest, openAi, googleSheets, emailSend. Event-driven trigger; 12 nodes.

Source: https://gist.github.com/AutomatesWithJohnson/22c01e32f9b1d8783d7709ca4907ae7d — 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

Grain Real Estate Land Showcase v1. Uses formTrigger, httpRequest, openAi, emailSend. Event-driven trigger; 13 nodes.

Form Trigger, HTTP Request, OpenAI +3
AI & RAG

Turns a simple form submission into a polished, priced PDF quote—automatically. Captures lead details via Form: Request a Quote. Loads your Google Sheets catalog (SKUs, price, stock, min qty, etc.). U

Form Trigger, Google Sheets, OpenAI +3
AI & RAG

Ask questions like “How much did I spend on food last month?” and get instant answers from your financial data — directly in Telegram.

Telegram Trigger, OpenAI, Google Sheets +2
AI & RAG

The Problem That it Solves

Google Drive Trigger, OpenAI, Google Drive +5
AI & RAG

This intelligent email automation workflow helps you maximize engagement through domain-based outreach. It utilizes AI-powered personalization and strategic follow-ups to increase response rates. The

Gmail, HTTP Request, Google Sheets +1