{
  "name": "B2B Sales Outreach Automation with n8n, Apollo and GPT",
  "nodes": [
    {
      "id": "ef1b8e9f-7fcc-4a2c-932e-7733efbad2c4",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        528,
        -320
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini",
          "cachedResultName": "gpt-5-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "5be27344-0a6f-44f2-bd3d-52dca6346ec1",
      "name": "scrapeLeads",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        800,
        -448
      ],
      "parameters": {
        "url": "=https://api.apify.com/v2/acts/code_crafter~apollo-io-scraper/run-sync-get-dataset-items?token={{ $('Scraping setup').item.json['Apify Api key'] }}",
        "method": "POST",
        "options": {
          "timeout": 180000
        },
        "jsonBody": "={\n \"contact_email_exclude_catch_all\": true,\n \"contact_email_status_v2_verified\": true,\n \"include_email\": true,\n \"max_result\": 10,\n \"url\": \"{{ $json.text }}\"\n}",
        "sendBody": true,
        "specifyBody": "json"
      },
      "typeVersion": 4.2
    },
    {
      "id": "cfbc6d68-8acf-4b10-b667-61ba91cd48f3",
      "name": "getLeads",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        0,
        -48
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $json.leadsSheetTabName }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.leadSheetID }}"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "01ad509c-1368-4fc2-8930-5b76f312ed8d",
      "name": "cleanHTML",
      "type": "n8n-nodes-base.code",
      "position": [
        1472,
        -112
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\nconst results = items.map(item => {\n const rawHtml = item.json.data || '';\n\n const cleaned = rawHtml\n .replace(/<script[\\s\\S]*?>[\\s\\S]*?<\\/script>/gi, '')\n .replace(/<style[\\s\\S]*?>[\\s\\S]*?<\\/style>/gi, '')\n .replace(/<!--[\\s\\S]*?-->/g, '')\n .replace(/<[^>]+>/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim();\n\n return { json: { text: cleaned } };\n});\n\nreturn results;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "f8f9dfb1-bfd1-4614-afd5-f44dcc633faf",
      "name": "getCompany",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        1248,
        -112
      ],
      "parameters": {
        "url": "={{ $('getLeads').item.json.organization_website_url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "5f243457-8b9f-4e37-8fd1-2ed9edc24ec6",
      "name": "copyTable",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        224,
        -448
      ],
      "parameters": {
        "name": "={{ $('setICP').item.json.Position }} - {{ $('setICP').item.json['Location (country)'] }} ({{ $now.format('yyyy-MM-dd') }})",
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Scraping setup').item.json.leadSheetID }}"
        },
        "options": {},
        "operation": "copy"
      },
      "typeVersion": 3
    },
    {
      "id": "23e9af47-9bdc-4b0a-b182-89f6c5b52bb1",
      "name": "urlGenerator",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        448,
        -544
      ],
      "parameters": {
        "text": "=Target Audience: {{ $('setICP').item.json.Position }} in {{ $ ('setICP').item.json['Location (country)'] }}\n\n",
        "messages": {
          "messageValues": [
            {
              "message": "=You are a URL generation agent. Your task is to convert natural language input into a valid Apollo search URL string.\n\n[OUTPUT FORMAT]\n- Always output as: \n\nhttps://app.apollo.io/#/people?[query_parameters]\n\n[RULES]\n1. Encode all values using URL encoding (e.g., spaces become %20, commas become %2C).\n2. Use query parameters based on recognized Apollo filters:\n - organizationLocations[] for countries or cities\n - organizationNumEmployeesRanges[] for employee counts\n - qKeywords for keyword search\n - sortAscending=false and sortByField=%5Bnone%5D by default\n - page=1 by default\n3. Concatenate parameters using &.\n4. Output must match this example style:\n \nhttps://app.apollo.io/#/people?organizationLocations[]=United%20States&sortAscending=false&sortByField=%5Bnone%5D&page=1&qKeywords=digital%20marketing%20agency&organizationNumEmployeesRanges[]=1%2C10\n\n[NATURAL LANGUAGE EXAMPLES → OUTPUT BEHAVIOR]\n- \"Digital marketing agencies in the US with 1–10 employees\" \n→ organizationLocations[]=United%20States, organizationNumEmployeesRanges[]=1%2C10, qKeywords=digital%20marketing%20agency\n\n- \"AI startups in Canada with under 50 employees\" \n→ organizationLocations[]=Canada,  organizationNumEmployeesRanges[]=1%2C50, qKeywords=AI%20startup\n\nAlways return the URL exactly in the format shown.\n"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.6
    },
    {
      "id": "112e1852-8017-4415-80ae-642b18bd0e16",
      "name": "addLeads",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1248,
        -448
      ],
      "parameters": {
        "columns": {
          "value": {
            "email": "={{ $json.email }}",
            "last_name": "={{ $json.last_name }}",
            "first_name": "={{ $json.first_name }}",
            "organization_name": "={{ $json.organization_name }}",
            "title": "={{ $json.title }}",
            "headline": "={{ $json.headline }}",
            "organization_website_url": "={{ $json.organization_website_url }}"
          },
          "schema": [
            {
              "id": "status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "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": "organization_name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "organization_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "industry",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "industry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seniority",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "seniority",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "headline",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "headline",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "linkedin_url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "linkedin_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "country",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "country",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "city",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "city",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "short_description",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "short_description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "keywords",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "keywords",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seo_description",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "seo_description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "organization_website_url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "organization_website_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "organization_linkedin_url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "organization_linkedin_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "num_of_employees",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "num_of_employees",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "estimated_revenue",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "estimated_revenue",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "market_cap",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "market_cap",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "organization_city",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "organization_city",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Personalized Message",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Personalized Message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Research",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company Research",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Personal Research",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Personal Research",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Scraping setup').item.json.leadSheetTabName }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Scraping setup').item.json.leadSheetID }}"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "b4d4b3da-71a3-47f6-8904-a18ec3607e88",
      "name": "setICP",
      "type": "n8n-nodes-base.set",
      "position": [
        0,
        -448
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "505904b6-c6ac-42b8-9151-6d31a9ccb863",
              "name": "Position",
              "type": "string",
              "value": "Founder, Owner, Co-Founder"
            },
            {
              "id": "b285cbb8-b502-4ed3-a293-149bf0fab172",
              "name": "Location (country)",
              "type": "string",
              "value": "Netherlands, Sweden, Norway, Denmark, Belgium"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "86e4cb4f-d643-4f6f-9872-36d920908efb",
      "name": "setEmail",
      "type": "n8n-nodes-base.set",
      "position": [
        672,
        -112
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ca6c21da-a0c4-4d04-af99-bb552c61af59",
              "name": "lead_email",
              "type": "string",
              "value": "={{ $json.email }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "2c146e19-13df-4ea9-89a1-aab00af790de",
      "name": "personal Research",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        896,
        -112
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-search-preview",
          "cachedResultName": "GPT-4O-SEARCH-PREVIEW"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are an expert online researcher and biographical analyst with access to the open web, public records, professional profiles, and credible news sources.\n\nTask: Research the following individual in depth and compile a concise but information-rich profile. Focus on unique, noteworthy, or verifiable facts that go beyond basic résumé details. \n\nIndividual details:\nFirst Name: {{ $('Loop Leads').item.json.first_name }}\nLast Name: {{ $ ('Loop Leads').item.json.last_name }}\nHeadline: {{ $('Loop Leads').item.json.headline }} \nCurrent Role: {{ $('Loop Leads').item.json.title }} at {{ $('Loop Leads').item.json.organization_name }}\nemail: {{ $json.lead_email }}\n\nInstructions:\n\nSearch for reliable information about the person using multiple reputable sources (e.g., LinkedIn, industry publications, press releases, interviews, awards listings, conference speaker rosters). \n\nPrioritize information that demonstrates notable accomplishments, professional impact, awards, high-profile projects, innovations, leadership roles, patents, publications, or significant contributions in their field.\n\nIf available, include relevant affiliations, boards, charitable work, or media appearances.\n\nAvoid unverifiable claims, rumors, or personal/private details that are not public and professional in nature.\n\nReturn findings in a structured bullet-point list, starting with the most significant and unique facts first.\n\nEnd with a brief one-sentence summary highlighting the most remarkable aspect of this person’s career."
            }
          ]
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "b32202d0-d095-415c-b074-dbc802780443",
      "name": "company Research",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1696,
        -112
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-search-preview",
          "cachedResultName": "GPT-4O-SEARCH-PREVIEW"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Using the information provided about the company below, produce a succinct 3–5 sentence overview that captures its core identity, focus, and market position. Then, list exactly three bullet points highlighting the most notable or interesting achievements, innovations, or milestones from the company’s history or recent activities.\n\nCompany information:\n{{ $json.text }}\n\nInstructions:\n\nIdentify the company’s primary industry, products/services, and market scope from the provided text.\n\nFocus the summary on what makes the company stand out (e.g., scale, unique positioning, key innovations, partnerships, market impact).\n\nFor the bullet points, prioritize tangible achievements such as major product launches, significant awards, record-breaking performance, notable partnerships, or impactful social initiatives.\n\nUse clear, professional language and keep both the summary and bullet points strictly fact-based.\n\nAvoid repeating information across the summary and bullet points —each should add distinct value."
            }
          ]
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "c9171864-e9f8-477e-a38d-02b6b3c76aef",
      "name": "personal Message",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2272,
        -112
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5",
          "cachedResultName": "GPT-5"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are an expert in high-impact cold email outreach in Alex Hormozi’s style. \nYou will be given:\n- Prospect details\n- Research about the person & their company\n- Information about {{ $('Lead setup').item.json.brand_name }} and its services\n- A detailed ServiceDoc describing services, KPIs, and outcomes\n\nYour job:\nWrite ONE personalized cold email ≤100 words in a casual, spartan tone (like talking to a friend). \nNEVER output intros or outros—only the message body. \n\nInputs:\nFirst Name: {{ $('Loop Leads').item.json.first_name }}\nHeadline: {{ $('Loop Leads').item.json.headline }}\nJob Title: {{ $('Loop Leads').item.json.title }}\nCompany Name: {{ $('Loop Leads').item.json.organization_name }}\nPersonal Research: {{ $('personal Research').item.json.message.content }}\nCompany Research: {{ $('company Research').item.json.message.content }}\nBrand Name: {{ $('Lead setup').item.json.brand_name }}\nBooking link: {{ $('Lead setup').item.json.booking_link }} \nServiceDoc: {{ $json.content }}\n\n### Connection-Finding Logic:\n1. From Personal/Company Research, identify the main business goal or pain.\n2. Select ONE best-fit service from the ServiceDoc based on role, KPIs, triggers, and keywords.\n3. Tie the measurable outcome directly to a KPI relevant to the prospect’s role. \n - If KPI data is missing, infer the most likely KPI for that role from the ServiceDoc.\n4. Use the prospect’s actual job title in the email (shorten if too long, e.g., \"Head of Operations\").\n5. Select from ServiceDoc: \n - ONE measurable outcome tied to the KPI\n - ONE **AI-related credibility hook** taken from the delivery history written in the ServiceDoc \n - ONE guarantee, with KPI explicitly included in the guarantee\n6. If no clear match, default to “Automation” with a process efficiency KPI.\n\n### Email Strategy:\n- Lead with a verifiable fact from research to show it’s not a mass email.\n- State a measurable offer tied to their KPI and the chosen service.\n- Add one credibility hook that highlights AI we’ve delivered.\n- Remove risk with the guarantee tied to the KPI.\n- Direct CTA: booking link + two fallback times. \n- End with “Best regards, {{ $('Lead setup').item.json.brand_name }} Team” (no personal names).\n\n### Template:\nHi [First Name],\n\nNoticed [specific relevant detail]. I help [their role/title] improve [KPI from the ServiceDoc] using [service from the ServiceDoc].\n\nRecently built [credibility hook from the ServiceDoc].\n\n[Guarantee from the ServiceDoc, with the KPI named.]\n\nBook a 15-min slot: [Booking Link]\n\nBest regards,\n{{ $('Lead setup').item.json.brand_name }} Team\n\n### Quality Rules:\n- ≤100 words\n- Specific metric + timeframe\n- No fluff, no generic claims\n- One service per email\n- All details must be supported by provided inputs or ServiceDoc (no inventing facts)\n- Credibility hooks must feature AI-related solutions described in the ServiceDoc\n"
            }
          ]
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "52e39c3b-2672-4dd2-b89f-5b428f3a58df",
      "name": "sendEmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        800,
        256
      ],
      "parameters": {
        "sendTo": "={{ $('Get approved leads').item.json.email }}",
        "message": "={{ $('Loop Approved Emails').item.json['Personalized Message'] }}",
        "options": {},
        "subject": "={{ $json.message.content.Subject }}",
        "emailType": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "7bc4df39-4869-4273-b6f7-75ecc825d38e",
      "name": "subjectLine",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        448,
        192
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "chatgpt-4o-latest",
          "cachedResultName": "CHATGPT-4O-LATEST"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "={{ $json['Personalized Message'] }}"
            },
            {
              "role": "system",
              "content": "=For this custom email, generate me an Alex Hormozi-style two-word subject line.\n\nOutput in json - Subject: "
            }
          ]
        },
        "jsonOutput": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "fec39122-d3d1-4fd5-8841-6344281200cb",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        -496
      ],
      "parameters": {
        "color": 5,
        "width": 544,
        "height": 240,
        "content": "## Flow 1: find leads\n\nDaily Lead Scraping trigger, Scraping setup, setICP, copyTable, urlGenerator (AI writes an Apollo search address), scrapeLeads (Apify), Limit leads to 10, addLeads.\n\nResult: new rows with first name, last name, email, title, headline, company and website in your Google Sheet."
      },
      "typeVersion": 1
    },
    {
      "id": "6d9ab4bf-2851-4d2b-b884-f7eaf5c18605",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        -144
      ],
      "parameters": {
        "color": 2,
        "width": 448,
        "height": 240,
        "content": "## Flow 2: research and write\n\nDaily Research Run trigger, Lead setup, getLeads, Limit leads to research, Loop Leads. For each lead: personal Research, getCompany, cleanHTML, company Research, Pull Service Document, personal Message, Update Lead Record.\n\nResult: Personal Research, Company Research and Personalized Message filled in the sheet. Nothing is sent here."
      },
      "typeVersion": 1
    },
    {
      "id": "73a54492-3425-45a8-b907-757af2772b9c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        224
      ],
      "parameters": {
        "color": 3,
        "width": 480,
        "height": 208,
        "content": "## Flow 3: send what you approved\n\nApproved Email Send trigger, Email setup, Get approved leads, Loop Approved Emails, subjectLine, sendEmail.\n\nIt sends one email per row whose status is exactly Approved. Nothing in the file changes the status after sending."
      },
      "typeVersion": 1
    },
    {
      "id": "ac5c73bd-566f-4cf7-8cdf-22eb99ea404a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1904,
        -496
      ],
      "parameters": {
        "width": 816,
        "height": 880,
        "content": "## Before you turn it on\n\nTemplate source: n8n Library at n8n.io. Prepared and documented by LeenLabs.\n\n1. Replace YOUR_GOOGLE_SHEET_ID, YOUR_APIFY_API_KEY, YOUR_GOOGLE_DOC_URL_OR_ID, YOUR_BRAND_NAME and YOUR_BOOKING_LINK in the Set nodes (Scraping setup, Lead setup, Email setup).\n2. Connect your own credentials: OpenAI, Google Sheets, Google Drive, Google Docs, Gmail.\n3. Open every AI node and choose a model your account still offers. Several model names in this file have been retired or are scheduled to be.\n4. Open the three Schedule Trigger nodes and set the interval and time yourself. The file stores empty rules.\n5. Write the ServiceDoc (a Google Doc describing your services, KPIs and guarantees) and check that personal Message does not promise anything you cannot deliver.\n6. After a send, change the status in your sheet yourself (for example to Sent). The file never does, so the next run would email the same rows again.\n7. Test with one row that holds your own email address.\n\nThis workflow collects personal data and sends real emails. Read the terms of every service involved and the rules that apply to you."
      },
      "typeVersion": 1
    },
    {
      "id": "ff0599c4-3cd6-45af-bde7-24a12c6f859b",
      "name": "Limit leads to 10",
      "type": "n8n-nodes-base.limit",
      "position": [
        1024,
        -448
      ],
      "parameters": {
        "maxItems": 10
      },
      "typeVersion": 1
    },
    {
      "id": "3e44c6d2-ba81-4ce1-86fb-d47501c7fa22",
      "name": "Loop Approved Emails",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        224,
        192
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "7b3655d4-92ab-4ca0-9108-83f5e4b17b9d",
      "name": "Loop Leads",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        448,
        -48
      ],
      "parameters": {
        "options": {},
        "batchSize": "=1"
      },
      "typeVersion": 3
    },
    {
      "id": "83585580-6130-47c6-be4d-6527369553d2",
      "name": "Trigger: Daily Lead Scraping",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -448,
        -448
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "285d542a-273d-4237-9b16-325d3a6eef5d",
      "name": "Trigger: Daily Research Run",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -448,
        -48
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "425a7fe8-a512-4906-ac7d-b50060566660",
      "name": "Trigger: Approved Email Send",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -448,
        256
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "048d5815-d0c3-4f6c-9039-6a5444672f2e",
      "name": "Update Lead Record",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2624,
        -48
      ],
      "parameters": {
        "columns": {
          "value": {
            "email": "={{ $('setEmail').item.json.lead_email }}",
            "Company Research": "={{ $('company Research').item.json.message.content }}",
            "Personal Research": "={{ $('personal Research').item.json.message.content }}",
            "Personalized Message": "={{ $json.message.content }}"
          },
          "schema": [
            {
              "id": "status",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "first_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "first_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "last_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "last_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "organization_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "organization_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "industry",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "industry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seniority",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "seniority",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "headline",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "headline",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "linkedin_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "linkedin_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "country",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "country",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "city",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "city",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "short_description",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "short_description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "keywords",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "keywords",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seo_description",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "seo_description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "organization_website_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "organization_website_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "organization_linkedin_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "organization_linkedin_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "num_of_employees",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "num_of_employees",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "estimated_revenue",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "estimated_revenue",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "market_cap",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "market_cap",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "organization_city",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "organization_city",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Personalized Message",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Personalized Message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Research",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company Research",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Personal Research",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Personal Research",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Lead setup').item.json.leadsSheetTabName }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Lead setup').item.json.leadSheetID }}"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "a81e4732-57be-4f73-b8fc-dfb9098406e3",
      "name": "Pull Service Document",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        2048,
        -112
      ],
      "parameters": {
        "operation": "get",
        "documentURL": "={{ $('Lead setup').item.json.serviceDocId }}"
      },
      "typeVersion": 2
    },
    {
      "id": "96c3f9ba-67d6-4f29-8f6c-46a3c4849d61",
      "name": "Get approved leads",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        0,
        256
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "Approved",
              "lookupColumn": "status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $json.leadsSheetTabName }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.leadSheetID }}"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "f8388600-bcc3-4c13-8adf-381669594ff3",
      "name": "Limit leads to research",
      "type": "n8n-nodes-base.limit",
      "position": [
        224,
        -48
      ],
      "parameters": {
        "maxItems": 2
      },
      "typeVersion": 1
    },
    {
      "id": "2f6d0aa7-c3f5-407c-a608-80462c394a81",
      "name": "Scraping setup",
      "type": "n8n-nodes-base.set",
      "position": [
        -224,
        -448
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "93ee900e-76c6-4989-ba63-9b791ee5a20a",
              "name": "Apify Api key",
              "type": "string",
              "value": "YOUR_APIFY_API_KEY"
            },
            {
              "id": "4f99ca2b-645e-479c-8506-43a04dbd5ef6",
              "name": "leadSheetID",
              "type": "string",
              "value": "YOUR_GOOGLE_SHEET_ID"
            },
            {
              "id": "06a5d478-a615-49da-9231-82915ad96731",
              "name": "leadsSheetTabName",
              "type": "string",
              "value": "Sheet1"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "12f08cda-099d-4b0a-b019-bd3484e2ef3c",
      "name": "Lead setup",
      "type": "n8n-nodes-base.set",
      "position": [
        -224,
        -48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4f99ca2b-645e-479c-8506-43a04dbd5ef6",
              "name": "leadSheetID",
              "type": "string",
              "value": "YOUR_GOOGLE_SHEET_ID"
            },
            {
              "id": "06a5d478-a615-49da-9231-82915ad96731",
              "name": "leadsSheetTabName",
              "type": "string",
              "value": "Sheet1"
            },
            {
              "id": "8d69835f-0b9b-415c-8902-b28bdef4eb77",
              "name": "serviceDocId",
              "type": "string",
              "value": "YOUR_GOOGLE_DOC_URL_OR_ID"
            },
            {
              "id": "0a071bf4-a0dc-4989-a885-b94c73120690",
              "name": "brand_name",
              "type": "string",
              "value": "YOUR_BRAND_NAME"
            },
            {
              "id": "c99e7110-c2ba-437a-bc5f-1f58697c759f",
              "name": "booking_link",
              "type": "string",
              "value": "YOUR_BOOKING_LINK"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0f590c22-3460-4d65-bf99-70e2c432cff1",
      "name": "Email setup",
      "type": "n8n-nodes-base.set",
      "position": [
        -224,
        256
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4f99ca2b-645e-479c-8506-43a04dbd5ef6",
              "name": "leadSheetID",
              "type": "string",
              "value": "YOUR_GOOGLE_SHEET_ID"
            },
            {
              "id": "06a5d478-a615-49da-9231-82915ad96731",
              "name": "leadsSheetTabName",
              "type": "string",
              "value": "Sheet1"
            },
            {
              "id": "0a071bf4-a0dc-4989-a885-b94c73120690",
              "name": "brand_name",
              "type": "string",
              "value": "YOUR_BRAND_NAME"
            },
            {
              "id": "c99e7110-c2ba-437a-bc5f-1f58697c759f",
              "name": "booking_link",
              "type": "string",
              "value": "YOUR_BOOKING_LINK"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3c9c675a-6e1c-48f3-9967-40eebd3f9017",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        -752
      ],
      "parameters": {
        "color": 5,
        "width": 544,
        "height": 240,
        "content": "## Lead sheet headers (row 1)\n\nstatus, first_name, last_name, organization_name, industry, title, seniority, headline, email, linkedin_url, country, city, short_description, keywords, seo_description, organization_website_url, organization_linkedin_url, num_of_employees, estimated_revenue, market_cap, organization_city, Personalized Message, Company Research, Personal Research\n\nType Approved in the status column for rows you want sent."
      },
      "typeVersion": 1
    }
  ],
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "setICP": {
      "main": [
        [
          {
            "node": "copyTable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "addLeads": {
      "main": [
        []
      ]
    },
    "getLeads": {
      "main": [
        [
          {
            "node": "Limit leads to research",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "setEmail": {
      "main": [
        [
          {
            "node": "personal Research",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cleanHTML": {
      "main": [
        [
          {
            "node": "company Research",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "copyTable": {
      "main": [
        [
          {
            "node": "urlGenerator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "sendEmail": {
      "main": [
        [
          {
            "node": "Get approved leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lead setup": {
      "main": [
        [
          {
            "node": "getLeads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Leads": {
      "main": [
        [],
        [
          {
            "node": "setEmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "getCompany": {
      "main": [
        [
          {
            "node": "cleanHTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email setup": {
      "main": [
        [
          {
            "node": "Get approved leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "scrapeLeads": {
      "main": [
        [
          {
            "node": "Limit leads to 10",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "subjectLine": {
      "main": [
        [
          {
            "node": "sendEmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "urlGenerator": {
      "main": [
        [
          {
            "node": "scrapeLeads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scraping setup": {
      "main": [
        [
          {
            "node": "setICP",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "company Research": {
      "main": [
        [
          {
            "node": "Pull Service Document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "personal Message": {
      "main": [
        [
          {
            "node": "Update Lead Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit leads to 10": {
      "main": [
        [
          {
            "node": "addLeads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "urlGenerator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "personal Research": {
      "main": [
        [
          {
            "node": "getCompany",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get approved leads": {
      "main": [
        [
          {
            "node": "Loop Approved Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Lead Record": {
      "main": [
        [
          {
            "node": "Loop Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Approved Emails": {
      "main": [
        [],
        [
          {
            "node": "subjectLine",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pull Service Document": {
      "main": [
        [
          {
            "node": "personal Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit leads to research": {
      "main": [
        [
          {
            "node": "Loop Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger: Daily Research Run": {
      "main": [
        [
          {
            "node": "Lead setup",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger: Approved Email Send": {
      "main": [
        [
          {
            "node": "Email setup",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger: Daily Lead Scraping": {
      "main": [
        [
          {
            "node": "Scraping setup",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "tags": []
}