AutomationFlowsAI & RAG › Outscraper - Ai-powered Lead Generation Pipeline

Outscraper - Ai-powered Lead Generation Pipeline

Outscraper - AI-powered lead generation pipeline. Uses n8n-nodes-outscraper, agent, lmChatOpenAi, outputParserStructured. Event-driven trigger; 11 nodes.

Event trigger★★★★☆ complexityAI-powered11 nodesN8N Nodes OutscraperAgentOpenAI ChatOutput Parser Structured
AI & RAG Trigger: Event Nodes: 11 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → OpenAI Chat 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
{
  "name": "Outscraper - AI-powered lead generation pipeline",
  "nodes": [
    {
      "parameters": {},
      "id": "ff791f2a-b102-467b-9eaf-3b5db012e5e7",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -112,
        208
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "industry",
              "name": "industry",
              "type": "string",
              "value": "dentists"
            },
            {
              "id": "location",
              "name": "location",
              "type": "string",
              "value": "Austin, TX"
            },
            {
              "id": "lead_limit",
              "name": "lead_limit",
              "type": "number",
              "value": 20
            }
          ]
        },
        "options": {}
      },
      "id": "9c060b1e-bf10-42e6-99ac-c22adc115e8f",
      "name": "Set Search Criteria",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        112,
        208
      ],
      "notesInFlow": true,
      "notes": "Change industry, location, and lead_limit before running."
    },
    {
      "parameters": {
        "query": "={{$json.industry + ' in ' + $json.location}}",
        "limit": "={{$json.lead_limit}}",
        "requestOptions": {}
      },
      "id": "2f4f5648-bab0-4fb7-9bd2-611b6cd2a80e",
      "name": "Outscraper - Google Maps Search",
      "type": "n8n-nodes-outscraper.outscraper",
      "typeVersion": 2,
      "position": [
        352,
        208
      ],
      "credentials": {
        "outscraperApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "function isBusinessRecord(value) {\n  return Boolean(\n    value &&\n      typeof value === 'object' &&\n      !Array.isArray(value) &&\n      (value.name || value.title || value.business_name || value.place_id || value.google_id || value.location_link)\n  );\n}\n\nfunction collectBusinessRecords(value, output = []) {\n  if (!value) return output;\n\n  if (Array.isArray(value)) {\n    for (const item of value) {\n      collectBusinessRecords(item, output);\n    }\n    return output;\n  }\n\n  if (isBusinessRecord(value)) {\n    output.push(value);\n    return output;\n  }\n\n  if (typeof value === 'object') {\n    for (const key of ['data', 'results', 'items', 'businesses']) {\n      if (key in value) {\n        collectBusinessRecords(value[key], output);\n      }\n    }\n  }\n\n  return output;\n}\n\nfunction cleanWebsite(value) {\n  if (!value || typeof value !== 'string') return '';\n\n  try {\n    return decodeURIComponent(value);\n  } catch {\n    return value;\n  }\n}\n\nconst leads = $input.all().flatMap((item) => collectBusinessRecords(item.json));\n\nreturn leads\n  .map((lead) => {\n    const website = cleanWebsite(lead.site || lead.website || lead.url || lead.domain || '');\n    return {\n      json: {\n        name: lead.name || lead.title || lead.business_name || '',\n        website,\n        domain_or_url: website,\n        phone: lead.phone || lead.phone_number || '',\n        address: lead.full_address || lead.address || '',\n        rating: lead.rating || '',\n        reviews: lead.reviews || lead.reviews_count || '',\n        category: lead.category || lead.type || lead.subtypes || '',\n        google_maps_url: lead.location_link || '',\n        source: 'google_maps',\n        raw: lead,\n      },\n    };\n  })\n  .filter((item) => item.json.name || item.json.website);"
      },
      "id": "fd399ca1-4067-470a-9623-cc8ccce16c85",
      "name": "Normalize Lead Candidates",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        592,
        208
      ]
    },
    {
      "parameters": {
        "resource": "emailsAndContacts",
        "query": "={{$json.domain_or_url}}",
        "additionalFields": {},
        "requestOptions": {}
      },
      "id": "234101e2-89b7-4365-ad8c-9aa0cf9486d8",
      "name": "Outscraper - Emails & Contacts",
      "type": "n8n-nodes-outscraper.outscraper",
      "typeVersion": 2,
      "position": [
        832,
        208
      ],
      "notesInFlow": true,
      "credentials": {
        "outscraperApi": {
          "name": "<your credential>"
        }
      },
      "notes": "Uses the website/domain from each Google Maps lead."
    },
    {
      "parameters": {
        "jsCode": "function findEmail(value) {\n  if (!value) return '';\n  if (typeof value === 'string' && value.includes('@')) return value;\n  if (Array.isArray(value)) {\n    for (const item of value) {\n      const email = findEmail(item);\n      if (email) return email;\n    }\n  }\n  if (typeof value === 'object') {\n    for (const nested of Object.values(value)) {\n      const email = findEmail(nested);\n      if (email) return email;\n    }\n  }\n  return '';\n}\n\nreturn $input.all().map((item) => {\n  const email = findEmail(item.json);\n  return {\n    json: {\n      ...item.json,\n      email,\n    },\n  };\n}).filter((item) => item.json.email);"
      },
      "id": "42fa10d2-1960-47bc-b096-99d5a3d136b7",
      "name": "Pick Best Email",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1072,
        208
      ]
    },
    {
      "parameters": {
        "resource": "emailValidator",
        "query": "={{$json.email}}",
        "additionalFields": {},
        "requestOptions": {}
      },
      "id": "6197f137-9d60-477f-8eac-f21f31f505ab",
      "name": "Outscraper - Email Validator",
      "type": "n8n-nodes-outscraper.outscraper",
      "typeVersion": 2,
      "position": [
        1312,
        208
      ],
      "notesInFlow": true,
      "credentials": {
        "outscraperApi": {
          "name": "<your credential>"
        }
      },
      "notes": "Uses the Email Validator resource from this Outscraper node package."
    },
    {
      "parameters": {
        "jsCode": "return $input.all().map((item) => {\n  const status = item.json.status || item.json.result || item.json.valid || '';\n  return {\n    json: {\n      ...item.json,\n      email_validation_status: status,\n      crm_payload: {\n        company: item.json.name,\n        website: item.json.website,\n        email: item.json.email,\n        phone: item.json.phone,\n        address: item.json.address,\n        rating: item.json.rating,\n        source: 'Outscraper Google Maps + Emails & Contacts',\n      },\n    },\n  };\n});"
      },
      "id": "211f197d-db9c-40dc-80df-41a12ced6962",
      "name": "Build CRM Payload",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1552,
        208
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Score this B2B lead from Outscraper data. Use the connected structured output parser and return only the requested JSON shape. Include the lead identity fields so the CRM node can store the scored result. Input JSON: {{ JSON.stringify($json) }}",
        "hasOutputParser": true,
        "options": {
          "enableStreaming": false
        }
      },
      "id": "24f43c61-fd1f-4fd8-a4d9-1535b1366d0e",
      "name": "AI Agent - Score Lead",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        1792,
        208
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-5.4-mini",
          "mode": "list",
          "cachedResultName": "gpt-5.4-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "id": "38d57d83-04be-456e-87c8-c7789eaa0200",
      "name": "OpenAI Chat Model - Score Lead",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        1728,
        416
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"additionalProperties\": false,\n  \"required\": [\n    \"company\",\n    \"website\",\n    \"email\",\n    \"phone\",\n    \"lead_score\",\n    \"score_reason\",\n    \"recommended_next_step\"\n  ],\n  \"properties\": {\n    \"company\": {\n      \"type\": \"string\"\n    },\n    \"website\": {\n      \"type\": \"string\"\n    },\n    \"email\": {\n      \"type\": \"string\"\n    },\n    \"phone\": {\n      \"type\": \"string\"\n    },\n    \"lead_score\": {\n      \"type\": \"number\"\n    },\n    \"score_reason\": {\n      \"type\": \"string\"\n    },\n    \"recommended_next_step\": {\n      \"type\": \"string\"\n    },\n    \"risks\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    }\n  }\n}"
      },
      "id": "d6d5389e-3a82-4103-82c9-7bd63e9eb79b",
      "name": "Structured Output Parser - Lead Score",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        2000,
        416
      ]
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Set Search Criteria",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Search Criteria": {
      "main": [
        [
          {
            "node": "Outscraper - Google Maps Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Outscraper - Google Maps Search": {
      "main": [
        [
          {
            "node": "Normalize Lead Candidates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Lead Candidates": {
      "main": [
        [
          {
            "node": "Outscraper - Emails & Contacts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Outscraper - Emails & Contacts": {
      "main": [
        [
          {
            "node": "Pick Best Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pick Best Email": {
      "main": [
        [
          {
            "node": "Outscraper - Email Validator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build CRM Payload": {
      "main": [
        [
          {
            "node": "AI Agent - Score Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Outscraper - Email Validator": {
      "main": [
        [
          {
            "node": "Build CRM Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent - Score Lead": {
      "main": [
        []
      ]
    },
    "OpenAI Chat Model - Score Lead": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - Score Lead",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser - Lead Score": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent - Score Lead",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "versionId": "ac9e4c04-e582-49e5-8e3d-0f3bef305a62",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "zklyd8A5I4RteP5y",
  "tags": []
}

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

Outscraper - AI-powered lead generation pipeline. Uses n8n-nodes-outscraper, agent, lmChatOpenAi, outputParserStructured. Event-driven trigger; 11 nodes.

Source: https://github.com/outscraper/n8n-nodes-outscraper/blob/9cf54fa8b92a0918647d806be3d6db55dad787bb/examples/ai-powered-lead-generation-pipeline.workflow.json — 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

🎯 Create viral TikToks, Shorts, Reels, podcasts, and ASMR videos in minutes — all on autopilot.

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

Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.

@Blotato/N8N Nodes Blotato, Google Sheets, OpenAI Chat +9
AI & RAG

RAG CHATBOT Main. Uses telegram, telegramTrigger, lmChatOpenAi, n8n-nodes-mcp. Event-driven trigger; 87 nodes.

Telegram, Telegram Trigger, OpenAI Chat +8
AI & RAG

The best content automation template in the market is now even better—with “deep research” on time-sensitive topics\! Unlike most n8n content automation templates that are mainly for “demo purposes,”

OpenAI, HTTP Request, XML +11
AI & RAG

Digital marketers, content creators, social media managers, and businesses who want to use AI marketing automation for YouTube Shorts without spending hours on production. This AI workflow helps anyon

OpenAI, HTTP Request, OpenAI Chat +7