{
  "id": "dqadS3ZrqFWZn5MU",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Enrich Airtable leads with insights from LinkedIn posts using OpenAI",
  "tags": [
    {
      "id": "EcGk5u5PdIdrDClg",
      "name": "Skool",
      "createdAt": "2025-07-15T10:11:16.143Z",
      "updatedAt": "2025-07-15T10:11:16.143Z"
    }
  ],
  "nodes": [
    {
      "id": "highlevel-sticky-note-001",
      "name": "TEMPLATE OVERVIEW",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4000,
        -100
      ],
      "parameters": {
        "color": "yellow",
        "value": "**Enrich Airtable leads with insights from LinkedIn posts using OpenAI**\n\nThis workflow automates advanced lead enrichment and personalized outreach by combining Airtable records with LinkedIn company pages, decision-maker profiles, and recent posts, then applying OpenAI for tailored insights.\n\n**Who is this for?**\nSales and marketing teams that want to personalize outreach at scale by blending company research, personal activity, and AI-generated messaging.\n\n**Setup Instructions:**\n- Open the `Configure Variables` node at the top to update Airtable base/table placeholders, Instantly campaign IDs, and default limits.\n- Add your API credentials (Apify, NeverBounce, Instantly) via the HTTP Request header placeholders or the n8n credential store before running.\n- Set your Airtable Base ID, Table ID, and record fields throughout the Airtable nodes.\n- Connect integrations for LinkedIn scraping (Apify), NeverBounce, Instantly, and OpenAI.\n- Review sticky notes flagged for user configuration and adjust node-specific settings.\n\n**Requirements:**\n- Active accounts and API access for Airtable, LinkedIn scraping (Apify), NeverBounce, Instantly, and OpenAI.\n- Sufficient API quotas for scraping LinkedIn profiles and posts.\n\nOptional: embed a Loom walkthrough link here to guide teammates through setup."
      },
      "typeVersion": 1
    },
    {
      "id": "5e730b84-42f9-4f77-9a0e-7d420d15b3bd",
      "name": "Configure Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        -3712,
        -48
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "airtableBaseId",
              "value": "YOUR_AIRTABLE_BASE_ID"
            },
            {
              "name": "airtableSourceTableId",
              "value": "YOUR_AIRTABLE_SOURCE_TABLE_ID"
            },
            {
              "name": "airtableTargetTableId",
              "value": "YOUR_AIRTABLE_TARGET_TABLE_ID"
            },
            {
              "name": "apifyPostsLimit",
              "value": "10"
            },
            {
              "name": "instantlyCampaignId",
              "value": "YOUR_INSTANTLY_CAMPAIGN_ID"
            }
          ]
        },
        "keepOnlySet": false
      },
      "typeVersion": 1
    },
    {
      "id": "a4bd3fd0-b6c9-48d0-8ae4-711fb4497e3a",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "notes": "const inputData = input.config()\nconst { recordId } = inputData;\nconst response = await fetch(\"YOUR PRODUCTION URL\"+\"?recordId=\"+recordId)\nconsole.log(response.status)",
      "position": [
        -3824,
        -48
      ],
      "parameters": {
        "path": "698bc83b-22b9-412f-894b-f74554964bcb",
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "6e1ff6d7-2d98-47c6-a342-d86cb62728f1",
      "name": "Turn X Items Into 1",
      "type": "n8n-nodes-base.code",
      "position": [
        1168,
        -240
      ],
      "parameters": {
        "jsCode": "return [{\n  mergedData: items.map(item => item.json.url) // Extract only the URLs, removing unnecessary objects\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "958f3613-bf2b-4a28-b574-19d61fb09264",
      "name": "Determine Valuable URLs",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1392,
        -240
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are given a **list of URLs extracted from a company\u2019s website**. Your task is to **identify and categorize the most relevant URLs** to help enrich lead data.  \n\nEach URL should be classified into **one of four key categories** that provide meaningful insights into the company\u2019s operations. If a category **does not have a matching URL**, return `\"no relevant URL\"` instead.  \n\n## **Selection Criteria & Context**  \n\n### **1. Company & Mission (About the Business & People Behind It)**  \n- **Purpose:** Find a page that explains **who the company is, what they stand for, and who runs it**.  \n- **Look for:** Company history, mission, vision, leadership, team, and core values.  \n- **Example matches:**  \n  - `/about`, `/company`, `/who-we-are`, `/our-story`, `/overview`, `/leadership`, `/team`, `/mission`, `/vision`  \n- **Avoid:** Generic pages like `/home`, contact pages, and customer support sections.  \n\n### **2. Offerings & Positioning (What They Sell & Their Market Fit)**  \n- **Purpose:** Identify a page that describes the company\u2019s **products, services, industries served, or unique differentiators**.  \n- **Look for:** Offerings, solutions, industry focus, and use cases.  \n- **Example matches:**  \n  - `/services`, `/what-we-do`, `/solutions`, `/products`, `/industries`, `/use-cases`, `/capabilities`  \n- **Avoid:** Pages that **only mention** clients but do not describe the company\u2019s services.  \n\n### **3. Process & Differentiation (How They Deliver Value)**  \n- **Purpose:** Identify a page that explains **how** the company operates and what makes them unique.  \n- **Look for:** Methodologies, workflows, onboarding process, value proposition, or unique technology/frameworks.  \n- **Example matches:**  \n  - `/how-it-works`, `/our-process`, `/methodology`, `/why-us`, `/why-choose-us`, `/approach`  \n- **Avoid:** Basic service descriptions without any details on processes or methodologies.  \n\n### **4. Proof of Success (Social Proof & Track Record)**  \n- **Purpose:** Find a page that demonstrates **the company\u2019s credibility through client results, testimonials, or case studies**.  \n- **Look for:** Success stories, partnerships, and testimonials.  \n- **Example matches:**  \n  - `/case-studies`, `/testimonials`, `/success-stories`, `/clients`, `/portfolio`  \n- **Avoid:** Generic client lists that do not contain results or success metrics.  \n\n## **Output Requirements**  \n- **Return exactly one URL per category** (or `\"no relevant URL\"` if none exist).  \n- **Output must be in JSON format** as shown below.  \n- **Only return the path (e.g., `/about` instead of `https://example.com/about`).**  \n- **Strictly follow the structured format\u2014no extra explanations or additional text.**  \n\n### **Expected Output Format**  \n```json\n{\n  \"selected_urls\": {\n    \"company_mission\": \"/about\",\n    \"offerings_positioning\": \"/solutions\",\n    \"process_differentiation\": \"/our-process\",\n    \"proof_of_success\": \"no relevant URL\"\n  }\n}\n```\n\n## **Additional Guidelines**  \n- **Prioritize broader coverage:** If multiple URLs match a category, choose the **most comprehensive one** (e.g., `/about` over `/company-overview`).  \n- **Handle duplicates:** If a URL appears more than once, select only one.  \n- **Exclude irrelevant pages:** Ignore contact pages, blog articles, FAQs, legal pages, or careers pages.  \n- **Do NOT infer missing information:** If no clear match exists, return `\"no relevant URL\"`.  "
            },
            {
              "content": "={{ $json.mergedData }}\n"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "69158508-dd0f-49f5-a346-6bc0cae91aa8",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1744,
        -240
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "message.content.selected_urls"
      },
      "typeVersion": 1
    },
    {
      "id": "da84a62e-8ad7-4fd9-850b-97130a109199",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "{{ $('Pull Lead From Airtable,').first().json['Company Website'] }}{{ $json['message.content.selected_urls'] }}",
      "onError": "continueRegularOutput",
      "position": [
        1968,
        -240
      ],
      "parameters": {
        "url": "={{(() => {\n  const website = $('Pull Lead From Airtable').first().json['Company Website'];\n  const email = $('Pull Lead From Airtable').first().json['Email Address'];\n  // If 'Company Website' is empty, derive from 'Email Address'\n  return website || `https://${email.split('@')[1]}`;\n})()}}{{ $json['message.content.selected_urls'] === 'no relevant url' ? '' : $json['message.content.selected_urls'] }}",
        "options": {}
      },
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "1a3987d9-832d-4846-9701-0d3e6c59d46f",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        2192,
        -240
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "data"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5572b8a0-fa43-4b6f-a14b-d6fd76f233b5",
      "name": "Remove HTML Homepage",
      "type": "n8n-nodes-base.code",
      "position": [
        304,
        -464
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const htmlContent = $node[\"Company Homepage Scraper\"].json[\"data\"]; // Replace this with the field containing your HTML content\n\n// Function to strip HTML tags and clean the text\nconst extractPlainText = (html) => {\n    if (!html) return \"\";\n\n    // Remove script and style tags along with their content\n    const withoutScriptsAndStyles = html.replace(/<script[\\s\\S]*?>[\\s\\S]*?<\\/script>/gi, \"\")\n                                        .replace(/<style[\\s\\S]*?>[\\s\\S]*?<\\/style>/gi, \"\");\n\n    // Remove all remaining HTML tags\n    const strippedText = withoutScriptsAndStyles.replace(/<\\/?[^>]+(>|$)/g, \"\");\n\n    // Replace HTML entities with their plain-text equivalents\n    const decodedText = strippedText.replace(/&nbsp;/gi, \" \")\n                                    .replace(/&amp;/gi, \"&\")\n                                    .replace(/&lt;/gi, \"<\")\n                                    .replace(/&gt;/gi, \">\")\n                                    .replace(/&quot;/gi, \"\\\"\")\n                                    .replace(/&#39;/gi, \"'\");\n\n    // Replace multiple spaces, tabs, and newlines with a single space\n    const cleanedText = decodedText.replace(/\\s+/g, \" \").trim();\n\n    return cleanedText;\n};\n\n// Call the function to process the HTML content\nconst plainText = extractPlainText(htmlContent);\n\n// Return the plain text as the output of this node\nreturn {\n    plainText: plainText,\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "83a5a1ef-f19f-44cb-923f-96aadd897e3b",
      "name": "Remove HTML Webpages",
      "type": "n8n-nodes-base.code",
      "position": [
        2400,
        -240
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\nconst cleanText = (html) => {\n    return html\n        .replace(/<script[\\s\\S]*?>[\\s\\S]*?<\\/script>/gi, '')  // Remove scripts\n        .replace(/<style[\\s\\S]*?>[\\s\\S]*?<\\/style>/gi, '')    // Remove styles\n        .replace(/<!--[\\s\\S]*?-->/g, '')                     // Remove comments\n        .replace(/<\\/?[^>]+(>|$)/g, '')                      // Remove HTML tags\n        .replace(/&nbsp;/gi, \" \")                           // Decode HTML entities\n        .replace(/&amp;/gi, \"&\")\n        .replace(/&lt;/gi, \"<\")\n        .replace(/&gt;/gi, \">\")\n        .replace(/&quot;/gi, \"\\\"\")\n        .replace(/&#39;/gi, \"'\")\n        .replace(/\\s+/g, ' ')                                // Normalize whitespace\n        .trim();\n};\n\nconst updatedItems = items.map((item) => {\n    const data = item.json.data.map(cleanText);\n    return { ...item.json, data };\n});\n\nreturn updatedItems;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "f21dd167-8bfd-4450-bd20-c1989a5d41f5",
      "name": "Analyze Company/Mission",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1152,
        0
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=**Prompt:**  \n\nAnalyze the following company data and extract **only verifiable information** from the text. The output should be written as a **cohesive business overview** without unnecessary repetition or conclusions. **Do not fabricate or infer missing details**\u2014only include what is explicitly stated.  \n\nThe analysis should cover:  \n\n1. **Company History & Founders** \u2013 Who founded it, when (if stated), and any background on why it was established.  \n2. **Mission Statement & Core Values** \u2013 The company\u2019s core purpose, guiding principles, and approach to business.  \n3. **Vision Statement & Future Goals** \u2013 Any stated long-term objectives or future aspirations.  \n4. **Industries Served & Target Audience** \u2013 Broad industry classification and specific client types served.  \n5. **Services & Specialties** \u2013 The exact services offered and any notable areas of specialization.  \n6. **Company Achievements & Recognition** \u2013 Any awards, recognitions, partnerships, or milestones mentioned.  \n\n**Output Format:**  \n\nWrite the response as a **well-structured business overview** in clear paragraphs. **Do not include bullet points, lists, or conclusions.** Keep the tone **neutral, factual, and concise** while ensuring clarity. If specific details (e.g., founding year, awards) are not mentioned, **state that they are not provided** instead of assuming.  \n\n### **Additional Instruction:**  \nFor any detail that is not explicitly provided in the text, simply state \"Not mentioned in the text.\" Do not add extra commentary, qualifiers like \"However,\" or any inferred information. Keep your response strictly factual and concise."
            },
            {
              "content": "=Input: {{ $json.finalText }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "e26d8031-cc52-443c-b987-cedcdb4e2a94",
      "name": "Analyze Offerings & Positioning",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1712,
        0
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=### **Prompt:**  \n\nAnalyze the following company data and extract **only verifiable information** from the text. The output should be written as a **cohesive business overview** without unnecessary repetition or conclusions. **Do not fabricate or infer missing details**\u2014only include what is explicitly stated.  \n\nThe analysis should cover:  \n\n1. **Core Products & Services** \u2013 The exact products or services the company offers, how they function, and their benefits to customers.  \n2. **Feature Lists & Differentiators** \u2013 What makes the company\u2019s offerings unique compared to competitors (e.g., superior technology, customization, industry expertise).  \n3. **Pricing Models** \u2013 If mentioned, describe the company's pricing approach (e.g., subscription-based, enterprise-level, one-time fee). If pricing is not provided, state that it is not mentioned.  \n4. **Industries Served** \u2013 A more detailed look at niche verticals or specialized markets the company caters to.  \n5. **Use Cases & Applications** \u2013 Real-world applications of the company\u2019s solutions, who benefits from them, and how they solve specific problems.  \n6. **Target Customers** \u2013 Whether the company serves SMBs, enterprises, B2B, B2C, or a specific customer segment.  \n7. **Service & Support Approach** \u2013 If mentioned, describe how the company supports its customers (e.g., dedicated account management, 24/7 support, implementation services).  \n8. **Geographical Reach** \u2013 If applicable, mention whether the company operates locally, nationally, or globally.  \n\n### **Output Format:**  \nWrite the response as a **well-structured business overview** in clear paragraphs. **Do not use bullet points, lists, or conclusions.** Keep the tone **neutral, factual, and concise** while ensuring clarity. If specific details (e.g., pricing, support) are not mentioned, **state that they are not provided** instead of assuming.  \n\n### **Additional Instruction:**  \nFor any detail that is not explicitly provided in the text, simply state \"Not mentioned in the text.\" Do not add extra commentary, qualifiers like \"However,\" or any inferred information. Keep your response strictly factual and concise."
            },
            {
              "content": "=Input: {{ $json.finalText }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "1ac9e801-007f-400a-be4a-68fb78dbf0be",
      "name": "Analyze Process & Differentiation",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2272,
        0
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=### **Prompt:**  \n\nAnalyze the following company data and extract **only verifiable information** from the text. The output should be written as a **cohesive business overview** without unnecessary repetition or conclusions. **Do not fabricate or infer missing details**\u2014only include what is explicitly stated.  \n\nThe analysis should cover:  \n\n1. **Company Methodology** \u2013 How the company delivers its services (e.g., agile, data-driven, consultative, customer-centric). If specific methodologies or approaches are mentioned, describe them.  \n2. **Step-by-Step Process** \u2013 If outlined, explain how the company operates from client onboarding to delivering results. Include any structured workflows or frameworks.  \n3. **Proprietary Tech or Frameworks** \u2013 Mention any unique models, software, patents, or proprietary methodologies that differentiate the company.  \n4. **Value Proposition** \u2013 What makes this company stand out? Identify key selling points compared to competitors, such as efficiency, customization, cost-effectiveness, or expertise.  \n5. **Onboarding Experience** \u2013 How the company interacts with new clients, including the initial consultation, setup, or integration process.  \n6. **Key Metrics & Focus Areas** \u2013 Identify any performance indicators they highlight, such as cost reduction, ROI, revenue impact, speed, or efficiency.  \n7. **Customer Engagement & Communication** \u2013 If mentioned, describe how the company interacts with clients (e.g., regular reporting, dedicated account managers, transparent feedback loops).  \n8. **Scalability & Adaptability** \u2013 If relevant, include how the company adapts to different client needs, business sizes, or industries.  \n\n### **Output Format:**  \nWrite the response as a **well-structured business overview** in clear paragraphs. **Do not use bullet points, lists, or conclusions.** Keep the tone **neutral, factual, and concise** while ensuring clarity. If specific details (e.g., proprietary tech, onboarding steps) are not mentioned, **state that they are not provided** instead of assuming.  \n\n### **Additional Instruction:**  \nFor any detail that is not explicitly provided in the text, simply state \"Not mentioned in the text.\" Do not add extra commentary, qualifiers like \"However,\" or any inferred information. Keep your response strictly factual and concise."
            },
            {
              "content": "=Input: {{ $json.finalText }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "7cf522a5-a716-4264-bdfc-14a0b4bd3f41",
      "name": "Analyze Proof Of Success",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2832,
        0
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=### **Prompt:**  \n\nAnalyze the following company data and extract **only verifiable proof of success** from the text. The output should be written as a **detailed, fact-based summary** without unnecessary repetition, speculation, or conclusions. **Do not fabricate or infer missing details\u2014only include what is explicitly stated.**  \n\nThe analysis should cover:  \n\n1. **Case Studies & Real-World Success** \u2013 Extract any case studies, including company names, industries, and specific outcomes achieved. Summarize the challenge, the company\u2019s solution, and the measurable results. If numerical improvements (e.g., increased revenue, cost reduction, hiring efficiency) are provided, include them.  \n2. **Testimonials & Client Feedback** \u2013 Identify any direct client quotes, including who provided them (e.g., job title, company). If a testimonial includes specific praise (e.g., speed, expertise, impact), highlight the most compelling details.  \n3. **Notable Clients & Partnerships** \u2013 If company names are mentioned, extract them accurately. If industries or company sizes are referenced, include them.  \n4. **Key Results & Metrics** \u2013 If quantifiable outcomes are stated (e.g., \"helped hire 500+ executives,\" \"reduced time-to-hire by 40%\"), extract these with precise figures.  \n5. **Awards & Recognition** \u2013 If industry awards, certifications, or high-profile partnerships are mentioned, list them with dates where available.  \n6. **Long-Term Impact & Reputation** \u2013 If there are statements about repeat clients, high retention rates, or ongoing relationships, include them.  \n7. **Third-Party Validation** \u2013 If the company\u2019s success has been referenced in media, research reports, or by industry experts, extract relevant mentions.  \n\n### **Output Format:**  \nWrite the response as a **detailed business overview** in **clear, structured paragraphs**. **Do not use bullet points, lists, or conclusions.** Maintain a **neutral, factual, and concise tone** while ensuring clarity. If no case studies, testimonials, or quantifiable proof are found, **state that the text does not contain this information** instead of assuming.  \n\n### **Additional Instruction:**  \nFor any detail that is not explicitly provided in the text, simply state \"Not mentioned in the text.\" Do not add extra commentary, qualifiers like \"However,\" or any inferred information. Keep your response strictly factual and concise."
            },
            {
              "content": "=Input: {{ $json.finalText }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "201988fa-20ff-484a-9094-6df8b07ed839",
      "name": "Remove Duplicates Texts C/M",
      "type": "n8n-nodes-base.code",
      "position": [
        944,
        0
      ],
      "parameters": {
        "jsCode": "const homepageText = $('Remove HTML Homepage').first()?.json?.plainText || \"\";\nconst sectionText = $('Remove HTML Webpages').first()?.json?.data?.[0] || \"\";\n\n// Normalize text by replacing multiple whitespace characters with a single space and trimming.\nconst normalizeText = text => (text ? text.replace(/\\s+/g, ' ').trim() : \"\");\n\nconst normalizedHomepageText = normalizeText(homepageText);\nconst normalizedSectionText = normalizeText(sectionText);\n\nconst finalText = normalizedHomepageText === normalizedSectionText\n  ? homepageText\n  : (homepageText && sectionText) \n    ? homepageText + \"\\n\" + sectionText\n    : homepageText || sectionText; // Return whichever one is available\n\nreturn [{ json: { finalText } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "0d1ef84a-8ad3-45c7-a8a7-c1b0af985eb8",
      "name": "Remove Duplicates Texts O/P",
      "type": "n8n-nodes-base.code",
      "position": [
        1504,
        0
      ],
      "parameters": {
        "jsCode": "const homepageText = $('Remove HTML Homepage').first()?.json?.plainText || \"\";\nconst sectionText = $('Remove HTML Webpages').first()?.json?.data?.[1] || \"\";\n\n// Normalize text by replacing multiple whitespace characters with a single space and trimming.\nconst normalizeText = text => (text ? text.replace(/\\s+/g, ' ').trim() : \"\");\n\nconst normalizedHomepageText = normalizeText(homepageText);\nconst normalizedSectionText = normalizeText(sectionText);\n\nconst finalText = normalizedHomepageText === normalizedSectionText\n  ? homepageText\n  : (homepageText && sectionText) \n    ? homepageText + \"\\n\" + sectionText\n    : homepageText || sectionText; // Return whichever one is available\n\nreturn [{ json: { finalText } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "f42e6ef2-527c-4f99-92c8-d2e93978e549",
      "name": "Remove Duplicates Texts P/D",
      "type": "n8n-nodes-base.code",
      "position": [
        2064,
        0
      ],
      "parameters": {
        "jsCode": "const homepageText = $('Remove HTML Homepage').first()?.json?.plainText || \"\";\nconst sectionText = $('Remove HTML Webpages').first()?.json?.data?.[2] || \"\";\n\n// Normalize text by replacing multiple whitespace characters with a single space and trimming.\nconst normalizeText = text => (text ? text.replace(/\\s+/g, ' ').trim() : \"\");\n\nconst normalizedHomepageText = normalizeText(homepageText);\nconst normalizedSectionText = normalizeText(sectionText);\n\nconst finalText = normalizedHomepageText === normalizedSectionText\n  ? homepageText\n  : (homepageText && sectionText) \n    ? homepageText + \"\\n\" + sectionText\n    : homepageText || sectionText; // Return whichever one is available\n\nreturn [{ json: { finalText } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "90663551-66df-4d37-bf12-fb22d66930c6",
      "name": "Remove Duplicates Texts PoS",
      "type": "n8n-nodes-base.code",
      "position": [
        2624,
        0
      ],
      "parameters": {
        "jsCode": "const homepageText = $('Remove HTML Homepage').first()?.json?.plainText || \"\";\nconst sectionText = $('Remove HTML Webpages').first()?.json?.data?.[3] || \"\";\n\n// Normalize text by replacing multiple whitespace characters with a single space and trimming.\nconst normalizeText = text => (text ? text.replace(/\\s+/g, ' ').trim() : \"\");\n\nconst normalizedHomepageText = normalizeText(homepageText);\nconst normalizedSectionText = normalizeText(sectionText);\n\nconst finalText = normalizedHomepageText === normalizedSectionText\n  ? homepageText\n  : (homepageText && sectionText) \n    ? homepageText + \"\\n\" + sectionText\n    : homepageText || sectionText; // Return whichever one is available\n\nreturn [{ json: { finalText } }];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "3c8851c5-6db5-4b3f-a29f-8f979216f76c",
      "name": "Pull Lead From Airtable",
      "type": "n8n-nodes-base.airtable",
      "notes": "{{ $json.query.recordId }}",
      "position": [
        -3616,
        -48
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableBaseId\"] }}"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableSourceTableId\"] }}"
        },
        "options": {}
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b4c33e20-fb9c-461a-bdbe-72d68d1b5e0d",
      "name": "Analyze Company LinkedIn",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -1440,
        -464
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=### **Prompt:**  \n\nAnalyze the following **LinkedIn company profile data** and extract **only verifiable information** from the text. The output should be written as a **cohesive and structured overview**, divided into three sections:  \n\n1. **Company Overview** \u2013 Extract the **full official company name** as stated on the profile. Provide the **overview statement** exactly as written in the \"About\" section without modification. Identify the **industry classification** as explicitly mentioned.  \n\n2. **Company Details** \u2013 Extract the **company size range** as stated on LinkedIn (e.g., 51-200 employees). If available, include the **exact number of employees listed as \"associated members\"** on LinkedIn. Provide the **year of founding** if explicitly stated. Extract **specializations** exactly as written in the \"Specialties\" section. List **office locations** as stated under the \"Locations\" section. If any of these details are missing, state **\"Not mentioned in the text.\"**  \n\n3. **Funding Information** \u2013 If applicable, extract details on the **most recent funding round**, including the funding type (e.g., Series A, Series B) and the date if provided. Identify the **company\u2019s funding stage or status** (e.g., bootstrapped, venture-backed, acquired). If funding information is not available, state **\"Not mentioned in the text.\"**  \n\nThe response should be **fact-based, clearly structured, and free from assumptions or interpretations**. **Do not fabricate or infer missing details**\u2014only include what is explicitly stated in the text.  \n\n### **Output Format:**  \n\n#### **Company Overview**  \n[Write a structured paragraph including the company name, overview statement, and industry classification.]  \n\n#### **Company Details**  \n[Write a structured paragraph listing company size, exact employee count (if available), founding year, specializations, and office locations.]  \n\n#### **Funding Information**  \n[Write a structured paragraph summarizing funding details if available. If no funding information is provided, state \"Not mentioned in the text.\"]  \n\n**Additional Instruction:**  \n- Do not include bullet points\u2014write in **clear, well-structured paragraphs** for easy readability.  \n- Avoid redundancy and unnecessary filler text\u2014**keep it concise yet informative**.  \n- For any detail that is not explicitly provided in the text, simply state \"Not mentioned in the text.\" Do not add extra commentary, qualifiers like \"However,\" or any inferred information. Keep your response strictly factual and concise."
            },
            {
              "content": "=Input: {{ $('Remove HTML LinkedIn Page').item.json.plainText }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "8b9ca2b5-73ce-42a5-a67a-73fdde833c37",
      "name": "LinkedIn Profile Scraper",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "[INPUT JSON FROM APIFY SCRAPER HERE]\n\nYOU WANT THE LINKEDIN PROFILE URL TO BE VARIABLE US THIS AS AN EXMAMPLE: \"{{ $('Pull Lead From Airtable').item.json['LinkedIn URL'] }}\"\n\nhttps://www.linkedin.com/in/alexhormozi/",
      "onError": "continueRegularOutput",
      "position": [
        -1088,
        -464
      ],
      "parameters": {
        "url": "https://api.apify.com/v2/acts/curious_coder~linkedin-profile-scraper/run-sync-get-dataset-items",
        "method": "POST",
        "options": {},
        "jsonBody": "={YOUR APIFY JSON BODY}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer [YOUR APIFY API TOKEN]"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3f1c864a-73c6-45dc-bf3e-821b29268aee",
      "name": "JSON Into Text",
      "type": "n8n-nodes-base.code",
      "position": [
        -880,
        -464
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\nconst text = items.map((item) => JSON.stringify(item.json)).join(\", \");\n\nreturn { text };\n"
      },
      "typeVersion": 2
    },
    {
      "id": "41997bf8-1332-43f5-a724-fcfa43777f28",
      "name": "Analyze Personal LinkedIn",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -688,
        -464
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=### **Prompt: LinkedIn Personal Profile Data Extraction**  \n\nAnalyze the following **LinkedIn personal profile data** and extract **only verifiable information** from the text. The output should be written as a **cohesive and structured overview**, divided into three sections:  \n\n1. **Profile Overview** \u2013 Extract the **individual\u2019s full name** as stated on the profile. Summarize their **core expertise and skills**, focusing on areas of specialization, professional strengths, and industry focus. Highlight any **major career achievements, awards, or significant contributions** explicitly mentioned. If stated, include their **aspirations, long-term career goals, and professional ambitions**. If the profile contains information about their **personal mission, values, or guiding principles**, integrate those as well. Finally, describe their **unique value proposition**\u2014what differentiates them in their field, whether it\u2019s **technical expertise, leadership, or strategic vision**.  \n\n2. **Experience Summary** \u2013 Extract and provide a structured summary of the individual's **current job title, company, and tenure** as stated on their profile. Describe their **responsibilities, leadership role, and contributions to business growth** based on the text. If listed, include **previous positions and career trajectory**, showing how they have progressed over time. Mention **seniority level** (executive, management, specialist) if explicitly stated. Highlight any **key projects, deals, or initiatives** they have led or contributed to. If the profile contains details about their **industry background or sector expertise**, integrate that as well.  \n\n3. **Education & Training** \u2013 Extract and list the **individual\u2019s academic background, degrees earned, and universities attended** as displayed on their profile. Include **fields of study and specializations** relevant to their industry. If additional **certifications, executive programs, or professional development courses** are mentioned, summarize those as well. If no education details are provided, state **\"Not mentioned in the text.\"** instead of making assumptions.  \n\nThe response should be **fact-based, clearly structured, and free from assumptions or interpretations**. **Do not fabricate or infer missing details**\u2014only include what is explicitly stated in the text.  \n\n### **Output Format:**  \n\n#### **Profile Overview**  \n[Write a structured paragraph containing the full name, core expertise, skills, major career achievements, aspirations, professional goals, personal mission, values, and unique value proposition.]  \n\n#### **Experience Summary**  \n[Write a structured paragraph detailing their current role, responsibilities, tenure, contributions, career progression, seniority level, and key projects or business initiatives.]  \n\n#### **Education & Training**  \n[Write a structured paragraph listing degrees, universities, specializations, and certifications. If no education details are provided, state \"Not mentioned in the text.\"]  \n\n\n### **Additional Instructions:**  \n- Do **not** include bullet points\u2014write in **clear, structured paragraphs** for readability.  \n- Avoid redundancy\u2014**keep it concise yet informative**.  \n- If a specific detail is not explicitly provided, state **\"Not mentioned in the text.\"** Do **not** add extra commentary or inferred details.  \n- **Extract text exactly as written** in the profile; do not paraphrase or reword personal descriptions.  "
            },
            {
              "content": "=Input: {{ $json.text }}\nToday's date: {{ $now }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "1147d65a-9236-48f2-9133-5c257c005cd0",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        -576
      ],
      "parameters": {
        "color": 5,
        "width": 460,
        "height": 80,
        "content": "Link to Apify scraper used:\nhttps://console.apify.com/actors/PEgClm7RgRD7YO94b/input"
      },
      "typeVersion": 1
    },
    {
      "id": "82f25899-b778-4535-b870-2a54f18ef39f",
      "name": "Company Homepage Scraper",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        80,
        -464
      ],
      "parameters": {
        "url": "={{(() => {\n  const website = $('Pull Lead From Airtable').first().json['Company Website'];\n  const email = $('Pull Lead From Airtable').first().json['Email Address'];\n  // If 'Company Website' is empty, derive from 'Email Address'\n  return website || `https://${email.split('@')[1]}`;\n})()}}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "26eba49b-7856-412b-baa6-12a9da7ac2d1",
      "name": "Check If Empty",
      "type": "n8n-nodes-base.code",
      "position": [
        528,
        -464
      ],
      "parameters": {
        "jsCode": "return items.map(item => {\n  if (!item.json.plainText || item.json.plainText.trim().length === 0) {\n    return { json: { message: \"item is empty\" } };\n  } else {\n    return { json: item.json };\n  }\n});\n"
      },
      "typeVersion": 2
    },
    {
      "id": "130e8fc7-9186-469c-9714-3c30b286c900",
      "name": "Unable To Scrape Website?",
      "type": "n8n-nodes-base.if",
      "position": [
        752,
        -464
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f70aeaf4-f4ef-4cd6-b239-2f4911c079de",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.message }}",
              "rightValue": "item is empty"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1beee158-a13e-4b3d-b136-90ac2f3a0112",
      "name": "Update Lead W/ Enrichment",
      "type": "n8n-nodes-base.airtable",
      "notes": "{{ $json.query.recordId }}",
      "position": [
        2528,
        -640
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableBaseId\"] }}"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableTargetTableId\"] }}"
        },
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "19bad014-2599-4e03-ac95-9ddc23f38ab8",
      "name": "US: Yes or No?",
      "type": "n8n-nodes-base.if",
      "position": [
        -3008,
        -144
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "7540d0aa-8723-4dd0-9c11-f9ad60a4fa38",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $('Pull Lead From Airtable').item.json.Location }}",
              "rightValue": "United States"
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": false
    },
    {
      "id": "1be162b6-26c1-4b9e-979b-9e9ad1a5bce6",
      "name": "B2B: Yes or No?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1824,
        -240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "7540d0aa-8723-4dd0-9c11-f9ad60a4fa38",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.message.content['1.) Business Model']['Business Model (B2B/B2C)'] }}",
              "rightValue": "B2C"
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": false
    },
    {
      "id": "c7180a56-b748-4a69-aba1-c82318274307",
      "name": "Headcount: >5, <30?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1648,
        -336
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7540d0aa-8723-4dd0-9c11-f9ad60a4fa38",
              "operator": {
                "type": "number",
                "operation": "lte"
              },
              "leftValue": "={{ $json.message.content['2.) Number of Employees']['Exact Number of Employees'] }}",
              "rightValue": 30
            },
            {
              "id": "beb073f3-f5bc-4ec2-890e-f16ed4da2572",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $json.message.content['2.) Number of Employees']['Exact Number of Employees'] }}",
              "rightValue": 5
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": false
    },
    {
      "id": "4b544862-135c-47ff-84ad-de105237c874",
      "name": "LinkedIn Company Scraper",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2608,
        -240
      ],
      "parameters": {
        "url": "={{ $('Pull Lead From Airtable').item.json[\"LinkedIn Organization URL\"] }}",
        "options": {}
      },
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "6f62c5e1-f73a-4127-b25d-1c480bc7d657",
      "name": "Remove HTML LinkedIn Page",
      "type": "n8n-nodes-base.code",
      "position": [
        -2384,
        -240
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const htmlContent = $node[\"LinkedIn Company Scraper\"].json[\"data\"]; // Replace this with the field containing your HTML content\n\n// Function to strip HTML tags and clean the text\nconst extractPlainText = (html) => {\n    if (!html) return \"\";\n\n    // Remove script and style tags along with their content\n    const withoutScriptsAndStyles = html.replace(/<script[\\s\\S]*?>[\\s\\S]*?<\\/script>/gi, \"\")\n                                        .replace(/<style[\\s\\S]*?>[\\s\\S]*?<\\/style>/gi, \"\");\n\n    // Remove all remaining HTML tags\n    const strippedText = withoutScriptsAndStyles.replace(/<\\/?[^>]+(>|$)/g, \"\");\n\n    // Replace HTML entities with their plain-text equivalents\n    const decodedText = strippedText.replace(/&nbsp;/gi, \" \")\n                                    .replace(/&amp;/gi, \"&\")\n                                    .replace(/&lt;/gi, \"<\")\n                                    .replace(/&gt;/gi, \">\")\n                                    .replace(/&quot;/gi, \"\\\"\")\n                                    .replace(/&#39;/gi, \"'\");\n\n    // Replace multiple spaces, tabs, and newlines with a single space\n    const cleanedText = decodedText.replace(/\\s+/g, \" \").trim();\n\n    return cleanedText;\n};\n\n// Call the function to process the HTML content\nconst plainText = extractPlainText(htmlContent);\n\n// Return the plain text as the output of this node\nreturn {\n    plainText: plainText,\n};\n\n"
      },
      "executeOnce": false,
      "typeVersion": 2,
      "alwaysOutputData": false
    },
    {
      "id": "b2f00390-c34d-46b7-8301-bfd183b3d384",
      "name": "Update Lead - Not US",
      "type": "n8n-nodes-base.airtable",
      "notes": "{{ $('Pull Lead From Airtable').item.json.id }}",
      "position": [
        -2800,
        -48
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableBaseId\"] }}"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableTargetTableId\"] }}"
        },
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "e9ddee9f-79c5-497f-b701-78dac840e9b2",
      "name": "Update Lead - Not B2B",
      "type": "n8n-nodes-base.airtable",
      "notes": "{{ $('Pull Lead From Airtable').item.json.id }}",
      "position": [
        -1648,
        -144
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableBaseId\"] }}"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableTargetTableId\"] }}"
        },
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "3d04c36f-5570-48ce-b177-835ab3a19f31",
      "name": "Update Lead - Too Big or Small",
      "type": "n8n-nodes-base.airtable",
      "notes": "{{ $('Pull Lead From Airtable').item.json.id }}",
      "position": [
        -1440,
        -224
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableBaseId\"] }}"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableTargetTableId\"] }}"
        },
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "49834d73-4207-4c69-85e0-fe8b47407a78",
      "name": "Email Validation - NeverBounce",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -3424,
        -48
      ],
      "parameters": {
        "url": "=https://api.neverbounce.com/v4/single/check?email={{ $json[\"Email Address\"] }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer [YOUR NEVERBOUNCE API KEY]"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f3dc6331-e8f4-425b-9bbd-6ce273bab86a",
      "name": "Email Valid?",
      "type": "n8n-nodes-base.if",
      "position": [
        -3216,
        -48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "572a70bf-ae83-4107-906a-24d2d2971c44",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.result }}",
              "rightValue": "valid"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "faeaaf02-6a66-4508-9da7-ae405a9f6744",
      "name": "Update Lead - No Valid Email",
      "type": "n8n-nodes-base.airtable",
      "notes": "{{ $('Pull Lead From Airtable').item.json.id }}",
      "position": [
        -3008,
        64
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableBaseId\"] }}"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableTargetTableId\"] }}"
        },
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "01a468b4-def1-4225-992f-c12483d3612d",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        -2800,
        -240
      ],
      "parameters": {
        "amount": "={{ Math.floor(Math.random() * (20 - 8 + 1)) + 8 }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "e43c4b58-3010-47ff-ab54-c53576c544c9",
      "name": "Analyze Company LinkedIn_",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -2176,
        -240
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are an expert in professional business analysis and LinkedIn data extraction. Your task is to analyze the scraped LinkedIn profile of a company to produce a high-quality, detailed report. Your response must be precise, structured, and focused on the specific insights outlined below. Ensure all outputs are professional, fact-based, and well-organized."
            },
            {
              "content": "=**Prompt:**  \nAnalyze the scraped LinkedIn profile data and extract the following key details:  \n\n1.) **Business Model**: Determine whether the company operates in a **B2B (business-to-business)** or **B2C (business-to-consumer)** model. The response must clearly state only **one** of these options.  \n\n2.) **Number of Employees**: Extract the exact number of employees listed on the profile. This number is found in text formatted as: `\"Follow View all X employees\"`. **Always output as a numerical value (# number).**  \n\n### **Output Format (JSON)**  \nEnsure the output follows this exact structure:  \n\n```json\n{\n  \"1.) Business Model\": {\n    \"Business Model (B2B/B2C)\": \"Specify B2B or B2C\"\n  },\n  \"2.) Number of Employees\": {\n    \"Exact Number of Employees\": #\n  },\n}\n```\n\n### **Rules & Constraints:**  \n- **Strictly follow the JSON structure above.**  \n- **No assumptions** \u2013 only use explicitly stated data. If unavailable, return `\"Not specified\"` instead.  \n- **Never include additional details, descriptions, or filler text.**  \n- **Ensure \"Exact Number of Employees\" is always a # number.**  \n- **For the cybersecurity question, answer only \"Yes\" or \"No\".**  "
            },
            {
              "content": "={{ $json.plainText }}\n- Today's date: {{$now}}"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.7,
      "alwaysOutputData": false
    },
    {
      "id": "1b38b03a-c3d0-4191-ab9c-7d1cc6bc68ed",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2080,
        -1248
      ],
      "parameters": {
        "color": 7,
        "width": 500,
        "height": 200,
        "content": "From the Header & Top Navigation\nLikely Information Found:\n\nCompany Name \u2013 The official registered name of the company.\nIndustry \u2013 The primary sector in which the company operates (e.g., SaaS, healthcare, fintech).\nLocation \u2013 The company\u2019s geographic headquarters or primary office.\nCompany Size \u2013 Number of employees, often categorized into ranges (e.g., 1-10, 11-50, 51-200, etc.)."
      },
      "typeVersion": 1
    },
    {
      "id": "cb7ef910-c40a-4acc-93f7-0d5264c135c5",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -928,
        -1200
      ],
      "parameters": {
        "color": 5,
        "width": 500,
        "content": "From the Sidebar (Funding Section, if available)\nLikely Information Found:\n\nRecent Funding Round \u2013 If applicable, details on the company\u2019s latest funding event (e.g., Series A, Series B, amount, and date).\nFunding Stage/Status \u2013 Current funding position (e.g., bootstrapped, venture-backed, acquired)."
      },
      "typeVersion": 1
    },
    {
      "id": "13e88bf7-2c52-4ebc-a93c-c05bb1fb8970",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1504,
        -1488
      ],
      "parameters": {
        "color": 6,
        "width": 500,
        "height": 440,
        "content": "From the Company Overview/About Section\nLikely Information Found:\n\nCompany Name \u2013 The full official name of the company as stated on the profile.\nOverview Statement \u2013 The company\u2019s main description or summary from the \"About\" section. Extract the full statement without modification.\nIndustry \u2013 The primary industry classification of the company as explicitly mentioned.\nCompany Size (Range) \u2013 The estimated size of the company based on LinkedIn\u2019s provided range (e.g., 51-200 employees).\nExact Number of Employees (Associated Members) \u2013 The specific number of employees listed as \"associated members\" on LinkedIn. If unavailable, state \"Not mentioned in the text.\"\nFounded \u2013 The year the company was founded, if explicitly stated. If not mentioned, state \"Not mentioned in the text.\"\nSpecializations \u2013 Key areas of expertise, technologies, or capabilities listed under the \"Specialties\" section. Extract them exactly as stated without modification.\nOffice Locations \u2013 The exact office locations listed under the \"Locations\" section. If not specified, state \"Not mentioned in the text.\""
      },
      "typeVersion": 1
    },
    {
      "id": "575f91cf-da74-4fb1-8ec6-3fe66197b6d0",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -1408
      ],
      "parameters": {
        "color": 4,
        "width": 500,
        "height": 360,
        "content": "Experience Section\nLikely Information Found:\n\nCurrent job title & company \u2013 The individual's current role and employer, often paired with tenure details.\nJob responsibilities & impact \u2013 A summary of duties, leadership responsibilities, and contributions to business growth.\nCompany background & industry \u2013 The sector the company operates in, giving insight into their professional environment.\nPrevious positions & career trajectory \u2013 A timeline of past roles, showing career progression, promotions, or job changes.\nEmployment duration & stability \u2013 Length of time spent in different positions, useful for identifying job-hopping vs. long-term experience.\nSeniority level & leadership role \u2013 Whether they\u2019re at an executive, management, or specialist level in their organization.\nKey projects & initiatives \u2013 Notable projects, deals closed, or campaigns led, showcasing their business contributions."
      },
      "typeVersion": 1
    },
    {
      "id": "0dca7c82-8eb4-4cdd-9c6c-593edbb235fc",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        -1280
      ],
      "parameters": {
        "color": 7,
        "width": 500,
        "height": 240,
        "content": "Education Section\nLikely Information Found:\n\nAcademic background & degrees \u2013 The highest level of education achieved, such as Bachelor's, Master's, or PhD.\nUniversities attended \u2013 Institutions where they studied, which can signal prestige and networking potential.\nFields of study & specializations \u2013 Relevant majors or coursework that align with their industry expertise.\nAdditional certifications & training \u2013 Professional development courses, online certifications, or executive education programs."
      },
      "typeVersion": 1
    },
    {
      "id": "cf75c8fe-c6e8-4bb3-b9a7-1e464e7fd6d6",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        -1408
      ],
      "parameters": {
        "color": 3,
        "width": 500,
        "height": 360,
        "content": "Profile Header/About Section\nLikely Information Found:\n\nCore expertise & skills \u2013 Areas of specialization and professional strengths, typically extracted from the summary or skills section.\nCareer highlights & accomplishments \u2013 Major achievements, awards, or significant contributions mentioned in their narrative.\nAspirations & professional goals \u2013 Stated ambitions, future career moves, or long-term objectives.\nPersonal mission & values \u2013 Underlying motivations, beliefs, or industry impact they aim to achieve.\nIndustry focus & niche expertise \u2013 The specific industries or verticals they specialize in, such as finance, healthcare, or tech.\nUnique value proposition \u2013 What sets them apart from others in their field, whether it\u2019s leadership, technical expertise, or strategic vision.\nNarrative style & tone \u2013 Whether their profile is formal and professional, casual and personable, or aspirational and visionary."
      },
      "typeVersion": 1
    },
    {
      "id": "e60a8fa8-5ac8-48eb-aa9d-f810e9b5e9a2",
      "name": "Filter HTML For URLs",
      "type": "n8n-nodes-base.code",
      "position": [
        944,
        -240
      ],
      "parameters": {
        "jsCode": "const inputData = $node[\"Company Homepage Scraper\"].json.data; // Reference the correct node\n\nfunction extractHeaderLinks(htmlString) {\n    const headerLinks = htmlString.match(/<a[^>]+href=[\"'](.*?)[\"'][^>]*>(.*?)<\\/a>/g);\n    \n    if (!headerLinks) return [];\n\n    return headerLinks.map(link => {\n        const urlMatch = link.match(/href=[\"'](.*?)[\"']/);\n        const textMatch = link.match(/>(.*?)<\\/a>/);\n        return {\n            text: textMatch ? textMatch[1].trim() : '',\n            url: urlMatch ? urlMatch[1] : ''\n        };\n    }).filter(item => item.url); // Remove any empty URLs\n}\n\nreturn extractHeaderLinks(inputData);\n"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "9e62e964-c8b2-424a-9b48-276c5aff02b7",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        -1008
      ],
      "parameters": {
        "width": 1660,
        "height": 80,
        "content": "## Personal LinkedIn\n"
      },
      "typeVersion": 1
    },
    {
      "id": "95162812-129f-4e4e-a215-ef1f63f4c268",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2080,
        -1008
      ],
      "parameters": {
        "color": 3,
        "width": 1660,
        "height": 80,
        "content": "## Company LinkedIn\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e3683af0-6a22-4516-ab49-3c6cdae16632",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        768,
        352
      ],
      "parameters": {
        "color": 6,
        "width": 380,
        "height": 380,
        "content": "Company/Mission\nLikely Information Found:\n\nCompany history & origin \u2013 When it was founded, by whom, and why.\nMission statement \u2013 The company\u2019s core purpose and values.\nVision statement \u2013 Future goals and aspirations.\nCompany size & scale \u2013 Number of employees, locations, and growth trajectory.\nLeadership team \u2013 Founders, executives, and key decision-makers (great for name-dropping in emails).\nIndustries served \u2013 Broad industry classification (e.g., SaaS, healthcare, fintech).\nBrand tone & personality \u2013 Formal vs. casual, innovation-driven vs. tradition-focused.\nCompany achievements \u2013 Awards, recognitions, partnerships, or milestones."
      },
      "typeVersion": 1
    },
    {
      "id": "ce4c6b7a-ad13-4f70-82f7-6144e69441ec",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1232,
        352
      ],
      "parameters": {
        "color": 4,
        "width": 380,
        "height": 380,
        "content": "Offerings & Positioning\nLikely Information Found:\n\nCore products/services \u2013 What they sell and how it benefits customers.\nFeature lists & differentiators \u2013 What makes them unique vs. competitors.\nPricing models (sometimes) \u2013 Subscription-based, enterprise, per-user, etc.\nIndustries served \u2013 More detailed insight into niche verticals.\nUse cases \u2013 Real-world applications of their solution.\nTarget customers \u2013 SMBs, enterprises, B2B, B2C, etc."
      },
      "typeVersion": 1
    },
    {
      "id": "821d1407-13f9-49c5-8ff6-609fe54112c0",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        352
      ],
      "parameters": {
        "color": 3,
        "width": 380,
        "height": 380,
        "content": "Process & Differentiation\nLikely Information Found:\n\nCompany methodology \u2013 How they deliver their services (e.g., agile, data-driven, customer-centric).\nStep-by-step process \u2013 What happens from onboarding to results.\nProprietary tech or frameworks \u2013 Any unique models, methodologies, or patents.\nValue proposition \u2013 What makes them better than competitors.\nOnboarding experience \u2013 How they work with clients.\nKey metrics they focus on \u2013 Efficiency, cost reduction, revenue impact, etc."
      },
      "typeVersion": 1
    },
    {
      "id": "4d69204f-6919-471c-b941-288091123b5e",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2144,
        352
      ],
      "parameters": {
        "color": 5,
        "width": 380,
        "height": 380,
        "content": "Proof Of Success\nLikely Information Found:\n\nCase studies \u2013 Specific client success stories with numbers.\nTestimonials & client quotes \u2013 Social proof from previous customers.\nLogos of known clients \u2013 Enterprises, Fortune 500s, or industry leaders they serve.\nPortfolio of past work \u2013 Showcases and tangible results.\nSuccess metrics \u2013 Percentage improvements, ROI, saved time, etc."
      },
      "typeVersion": 1
    },
    {
      "id": "2d68ecd3-68a7-41e3-a312-ff82040e382c",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        768,
        224
      ],
      "parameters": {
        "color": 7,
        "width": 1760,
        "height": 80,
        "content": "## Company Website"
      },
      "typeVersion": 1
    },
    {
      "id": "8dd40c0e-d3d7-4434-bafa-8aef741130c6",
      "name": "Determine Variables",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1312,
        -656
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "GPT-4.1"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=### **Prompt**\n\nGiven the provided **LinkedIn data**\u2014including the company\u2019s \"About\" section, industry classification, company size, and the decision-maker\u2019s profile\u2014extract and structure the following **highly personalized** variables for a compelling cold email.\n\nThe output should seamlessly integrate into the following email template:\n\n### **Cold Email Template:**\n\n> **Subject:** (company_name) + Stroom: A new growth opportunity?  \n>  \n> Hi (first_name),  \n>  \n> I came across (company_name) and was really impressed by (company_specialty)\u2014especially with how you\u2019ve contributed to its growth.  \n>  \n> At Stroom, we help companies like yours build independent sales channels that generate additional revenue without interfering with existing strategies. Since (company_name) is already making waves in (industry), this could be a great way to scale further.  \n>  \n> Would it make sense to send over a quick breakdown of how similar companies are doing this?  \n>  \n> Best,  \n> [Your Name]  \n> Stroom  \n\n### **Guidelines for Extraction & Personalization:**\n\n- **Make it sound human.** Tone should be **casual, confident, and natural**\u2014avoid robotic or overly formal language.  \n- **Draw from context.** If the LinkedIn \u201cAbout\u201d section is vague, **use logic and pattern recognition** to fill in plausible details.  \n- **Personal, not generic.** The goal is to create an email that **feels handcrafted and relevant**, even when based only on LinkedIn.  \n- **Tight and to the point.** No wordy responses\u2014**short, punchy, and specific wins.**\n\n### **Variables to Extract & Formatting Rules:**\n\n#### **1. CompanyName**  \n- The official company name as shown on LinkedIn.  \n- Use correct capitalization and punctuation.\n\n#### **2. FirstName**  \n- The first name of the decision-maker (e.g., founder, CEO, Head of Growth).  \n- Use professional formatting (e.g., \"Jasper\", not \"jasper\" or \"Mr. Jasper\").\n\n#### **3. CompanySpecialty**  \n- One standout quality, result, or value proposition the company is known for.  \n- Usually found in the \u201cAbout\u201d section or inferred from company focus.  \n- Should read like a natural compliment (e.g., \u201cempowering retailers with AI-driven pricing\u201d).\n\n#### **4. Industry**  \n- Natural phrasing of the company\u2019s sector or vertical.  \n- Must fit grammatically in: _\u201cmaking waves in (industry)\u201d_\n\n### **Structured JSON Output Format:**\n\n```json\n{\n  \"company_name\": \"...\",\n  \"first_name\": \"...\",\n  \"company_specialty\": \"...\",\n  \"industry\": \"...\"\n}\n```"
            },
            {
              "content": "={{ $('Analyze Company LinkedIn').first().json.message.content }}. {{ $('Analyze Personal LinkedIn').first().json.message.content }}"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "3c84affd-66d0-4cc5-8e4b-0bcf69581242",
      "name": "Determine Variables.",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        3552,
        0
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "GPT-4.1"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are an expert in cold email personalization for B2B outreach. Your task is to extract **highly relevant variables** from company data to populate a cold email tailored to decision makers at **staffing & recruiting firms**.\n\nYou'll be given LinkedIn bios, websites, case studies, testimonials, or other context. Based on that, extract and structure the variables below, then insert them into the provided email template.\n\n### Email Template:\n\n> Hey (first_name),  \n>  \n> We help (CompanyOverview) firms reach (ICPofLead) struggling with (PainPointLeadSolves).  \n>  \n> With (Industry) becoming more competitive, we\u2019ve been working closely with founders to turn underperforming channels into scalable growth systems.  \n>  \n> We just booked 27 calls for a staffing & recruiting firm last month\u2014without paid ads or endless follow-ups.  \n>  \n> Would it be helpful if I showed you how?  \n>  \n> Best,  \n> Clarence  \n\n###  Your Lead List:\nAll contacts are **decision makers (founders, partners, directors, or heads of growth)** at **staffing & recruiting firms**. This should guide your language, assumptions, and variable selection.\n\n###  Guidelines for Extraction & Personalization:\n\n- **Write like a human.** Tone should be casual, sharp, and confident\u2014not robotic.\n- **Tailored to recruiting.** Every variable should feel written *for a recruiter* who\u2019s thinking about growth, sourcing, or placement metrics.\n- **Infer smartly.** If info is missing, deduce from context rather than saying \u201cnot listed.\u201d\n- **No filler.** Be direct, clean, and value-focused.\n- **Punchy and relevant.** Use phrases that sound natural in real cold outreach.\n\n###  Variables to Extract & Formatting Rules:\n\n#### 1. **CompanyOverview**  \n- A short, compelling phrase describing their core service/expertise.  \n- **3 words max.**  \n- Must fit: *We help [CompanyOverview] firms*  \n- **Examples:** `\"tech recruiting\"`, `\"executive search\"`, `\"healthcare staffing\"`\n\n#### 2. **ICPofLead**  \n- Who their ideal clients or placements are, in natural language.  \n- **4 words max.**  \n- Must fit: *reach [ICPofLead] struggling with [PainPointLeadSolves]*  \n- **Examples:** `\"high-growth startups\"`, `\"VC-backed fintechs\"`, `\"hospital networks in need\"`\n\n#### 3. **PainPointLeadSolves**  \n- The urgent business problem they solve for clients.  \n- **5 words max.**  \n- Must resonate with *client-side pain* (e.g. hiring speed, talent quality).  \n- **Examples:** `\"hiring top engineers fast\"`, `\"retaining hard-to-fill roles\"`\n\n#### 4. **Industry**  \n- A natural phrase for the industry they operate in.  \n- Must fit: *With [Industry] becoming more competitive...*  \n- **Examples:** `\"tech recruiting\"`, `\"executive search\"`, `\"life sciences staffing\"`\n\n### Final Output Format (JSON):\n\n```json\n{\n  \"CompanyOverview\": \"...\",\n  \"ICPofLead\": \"...\",\n  \"PainPointLeadSolves\": \"...\",\n  \"PrimaryServices\": \"...\",\n  \"Industry\": \"...\"\n}\n```"
            },
            {
              "content": "={{ $('Analyze Company/Mission').item.json.message.content }}. {{ $('Analyze Offerings & Positioning').item.json.message.content }}. {{ $('Analyze Process & Differentiation').item.json.message.content }}. {{ $('Analyze Proof Of Success').item.json.message.content }}. {{ $('Analyze Company LinkedIn').first().json.message.content }}. {{ $('Analyze Personal LinkedIn').first().json.message.content }}"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "465bd56b-dad3-43fb-a7e0-52f2babdcec1",
      "name": "Update Lead W/ Enrichment.",
      "type": "n8n-nodes-base.airtable",
      "position": [
        4784,
        32
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableBaseId\"] }}"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableTargetTableId\"] }}"
        },
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "802b7054-88a1-4fec-b696-440aa1c1560c",
      "name": "Upload Lead To Instantly.",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4784,
        208
      ],
      "parameters": {
        "url": "https://api.instantly.ai/api/v2/leads",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "jsonBody": "={\n  \"campaign\": \"{{$node[\"Configure Variables\"].json[\"instantlyCampaignId\"]}}\",\n  \"email\": \"{{ $('Pull Lead From Airtable').first().json['Email Address'] }}\",\n  \"personalization\": \"\",\n  \"website\": \"{{ $('Pull Lead From Airtable').first().json['Company Website'] }}\",\n  \"last_name\": \"\",\n  \"first_name\": \"{{ $('Pull Lead From Airtable').first().json['First Name'] }}\",\n  \"company_name\": \"{{ $('Clean Company Name.').item.json.message.content }}\",\n  \"phone\": \"{{ $('Pull Lead From Airtable').first().json.Phone }}\",\n  \"skip_if_in_workspace\": false,\n  \"skip_if_in_campaign\": true,\n  \"skip_if_in_list\": true,\n  \"custom_variables\": {\n    \"CompanyOverview\": \"{{ $json.message.content.CompanyOverview }}\",\n    \"ICPofLead\": \"{{ $json.message.content.ICPofLead }}\",\n    \"PainPointLeadSolves\": \"{{ $json.message.content.PainPointLeadSolves }}\",\n    \"industry\": \"{{ $json.message.content.Industry }}\"\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer [YOUR INSTANTLY API KEY]"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "19b3319e-adf8-4e50-8429-068126a6e095",
      "name": "Upload Lead To Instantly",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2528,
        -464
      ],
      "parameters": {
        "url": "https://api.instantly.ai/api/v2/leads",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "jsonBody": "={\n  \"campaign\": \"{{$node[\"Configure Variables\"].json[\"instantlyCampaignId\"]}}\",\n  \"email\": \"{{ $('Pull Lead From Airtable').first().json['Email Address'] }}\",\n  \"personalization\": \"\",\n  \"website\": \"{{ $('Pull Lead From Airtable').first().json['Website URL'] }}\",\n  \"last_name\": \"\",\n  \"first_name\": \"{{ $('Pull Lead From Airtable').first().json['First Name'] }}\",\n  \"company_name\": \"{{ $('Pull Lead From Airtable').first().json['Company Name'] }}\",\n  \"phone\": \"{{ $('Pull Lead From Airtable').first().json.Phone }}\",\n  \"skip_if_in_workspace\": false,\n  \"skip_if_in_campaign\": true,\n  \"skip_if_in_list\": true,\n  \"custom_variables\": {\n    \"industry\": \"{{ $json.message.content.industry }}\",\n    \"unique_strength_or_feature\": \"{{ $json.message.content.unique_strength_or_feature }}\"\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer [YOUR INSTANTLY API KEY]"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a2af0cad-984f-4960-8bfe-a3c7a782a525",
      "name": "Clean Company Name",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        944,
        -656
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "**Prompt: Ultimate Company Name Cleaner**\n\nYou are an expert in simplifying company names for professional communication. When given a company name, return only the **core name** that employees, customers, and partners would naturally use in casual conversation, emails, or internal documents.\n\nYour goal is to extract the **clean, concise, and informal version** of the name by applying the following rules:\n\n\n### What to Remove:\n- **Legal suffixes**: LLC, Ltd., Inc., GmbH, BV, SA, LLP, etc.\n- **Generic business terms**: Group, Partners, Solutions, Technologies, Agency, Recruiting, Consulting, Holdings, Services, Corporation, Co., and similar.\n- **Conjunctions and modifiers**: \"and\", \"&\", \u201cInternational\u201d, \u201cGlobal\u201d, \u201cWorldwide\u201d, \u201cEnterprises\u201d, \u201cCompany\u201d, \u201cFirm\u201d, etc.\n\n### What to Keep:\n- The **most distinctive and recognizable term** in the name.\n- **Acronyms** if they represent the core brand (e.g., \u201cIBM\u201d should stay \u201cIBM\u201d).\n- Single-word names even if they\u2019re generic-sounding (e.g., \u201cMonarch Holdings\u201d \u2192 \u201cMonarch\u201d).\n\n### Additional Heuristics:\n- If the name has **multiple meaningful words**, choose the **first** or **most brand-like** term used conversationally (e.g., \u201cOcular Recruiting\u201d \u2192 \u201cOcular\u201d).\n- If the company name is an **acronym followed by a descriptor**, retain only the acronym (e.g., \u201cXYZ Technologies\u201d \u2192 \u201cXYZ\u201d).\n- If the name is something like \u201cThe Fox & Badger Co.\u201d \u2192 return the part most likely used informally: **Fox & Badger** \u2192 **FoxBadger** or **Fox** if needed for brevity.\n- If the cleaned name still feels too long or awkward, simplify to what a team member might casually say (e.g., \u201cNorth Ridge Ventures\u201d \u2192 \u201cNorth Ridge\u201d or just \u201cNorth\u201d).\n\n** Output Format:**\nOutput only the cleaned company name \u2014 **no quotation marks, explanations, or extra text**.\n\n**Examples:**\n- \u201cOcular Recruiting\u201d \u2192 **Ocular**  \n- \u201cNimbus Solutions LLC\u201d \u2192 **Nimbus**  \n- \u201cBravado Group Inc.\u201d \u2192 **Bravado**  \n- \u201cApex & Co.\u201d \u2192 **Apex**  \n- \u201cXYTech Consulting BV\u201d \u2192 **XYTech**  \n- \u201cNorth Ridge Ventures Ltd.\u201d \u2192 **North Ridge** or **North** (based on common use)  \n- \u201cSkyline Holdings International\u201d \u2192 **Skyline**  \n- \u201cAVR Partners GmbH\u201d \u2192 **AVR**"
            },
            {
              "content": "=Scraped Company Name: {{ $('Pull Lead From Airtable').first().json['Company Name'] }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.7
    },
    {
      "id": "41d6943d-f212-458f-a64e-84a0a35e55e7",
      "name": "Clean Company Name.",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        3184,
        0
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "**Prompt: Ultimate Company Name Cleaner**\n\nYou are an expert in simplifying company names for professional communication. When given a company name, return only the **core name** that employees, customers, and partners would naturally use in casual conversation, emails, or internal documents.\n\nYour goal is to extract the **clean, concise, and informal version** of the name by applying the following rules:\n\n\n### What to Remove:\n- **Legal suffixes**: LLC, Ltd., Inc., GmbH, BV, SA, LLP, etc.\n- **Generic business terms**: Group, Partners, Solutions, Technologies, Agency, Recruiting, Consulting, Holdings, Services, Corporation, Co., and similar.\n- **Conjunctions and modifiers**: \"and\", \"&\", \u201cInternational\u201d, \u201cGlobal\u201d, \u201cWorldwide\u201d, \u201cEnterprises\u201d, \u201cCompany\u201d, \u201cFirm\u201d, etc.\n\n### What to Keep:\n- The **most distinctive and recognizable term** in the name.\n- **Acronyms** if they represent the core brand (e.g., \u201cIBM\u201d should stay \u201cIBM\u201d).\n- Single-word names even if they\u2019re generic-sounding (e.g., \u201cMonarch Holdings\u201d \u2192 \u201cMonarch\u201d).\n\n### Additional Heuristics:\n- If the name has **multiple meaningful words**, choose the **first** or **most brand-like** term used conversationally (e.g., \u201cOcular Recruiting\u201d \u2192 \u201cOcular\u201d).\n- If the company name is an **acronym followed by a descriptor**, retain only the acronym (e.g., \u201cXYZ Technologies\u201d \u2192 \u201cXYZ\u201d).\n- If the name is something like \u201cThe Fox & Badger Co.\u201d \u2192 return the part most likely used informally: **Fox & Badger** \u2192 **FoxBadger** or **Fox** if needed for brevity.\n- If the cleaned name still feels too long or awkward, simplify to what a team member might casually say (e.g., \u201cNorth Ridge Ventures\u201d \u2192 \u201cNorth Ridge\u201d or just \u201cNorth\u201d).\n\n** Output Format:**\nOutput only the cleaned company name \u2014 **no quotation marks, explanations, or extra text**.\n\n**Examples:**\n- \u201cOcular Recruiting\u201d \u2192 **Ocular**  \n- \u201cNimbus Solutions LLC\u201d \u2192 **Nimbus**  \n- \u201cBravado Group Inc.\u201d \u2192 **Bravado**  \n- \u201cApex & Co.\u201d \u2192 **Apex**  \n- \u201cXYTech Consulting BV\u201d \u2192 **XYTech**  \n- \u201cNorth Ridge Ventures Ltd.\u201d \u2192 **North Ridge** or **North** (based on common use)  \n- \u201cSkyline Holdings International\u201d \u2192 **Skyline**  \n- \u201cAVR Partners GmbH\u201d \u2192 **AVR**"
            },
            {
              "content": "=Scraped Company Name: {{ $('Pull Lead From Airtable').first().json['Company Name'] }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.7
    },
    {
      "id": "326a5532-c757-4691-b354-2bc56252de8e",
      "name": "Scrape Personal LinkedIn Posts",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -320,
        -464
      ],
      "parameters": {
        "url": "https://api.apify.com/v2/acts/apimaestro~linkedin-profile-posts/run-sync-get-dataset-items",
        "options": {},
        "jsonBody": "={\n    \"limit\": {{ $node[\"Configure Variables\"].json[\"apifyPostsLimit\"] }},\n    \"username\": \"{{ $('Pull Lead From Airtable').item.json[\"LinkedIn URL\"] }}\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer [YOUR APIFY API TOKEN]"
            }
          ]
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "ebe46ebe-bea4-4686-9eb8-7525a56c3d2f",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        -576
      ],
      "parameters": {
        "color": 6,
        "width": 440,
        "height": 80,
        "content": "Link to Apify scraper used:\nhttps://console.apify.com/actors/LQQIXN9Othf8f7R5n/input"
      },
      "typeVersion": 1
    },
    {
      "id": "c2e8805d-fc08-4f1f-9865-9acd4df924cc",
      "name": "Posts Available?",
      "type": "n8n-nodes-base.if",
      "position": [
        1664,
        -656
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f232b79d-b540-4236-aae8-ed92285a626b",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $('Scrape Personal LinkedIn Posts').first().json.message }}",
              "rightValue": "No posts found for this profile"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "34845405-8360-48ab-94f7-b703dacca0d2",
      "name": "Craft Opening Line - Posts",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1888,
        -848
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "GPT-4.1"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=## Prompt: Personalized LinkedIn Post Opener Generation\n\nYou are a world-class AI assistant specialized in writing high-converting personalized cold outreach openers.\n\nYou will receive a JSON object with a property called `posts`. This property contains an array of LinkedIn post objects. Each object includes, at minimum, a `text`, `post_type`, `url`, and `posted_at.date`. Some posts may also include fields such as `author`, `reshared_post`, etc.\n\n---\n\n### Your Task\n\n1. **Select the single most relevant post to reference in a cold outreach message.**\n   Carefully consider all posts and apply the following strict filtering and ranking criteria:\n\n   #### **Hard Filtering Criteria**\n\n   * **Exclude all reposts or reshares** (`post_type` is `repost`, or posts with a `reshared_post` field).\n   * **Exclude posts about politics, religion, or controversial topics.**\n   * **Exclude posts with little substance (less than 15 words, or pure memes/quotes).**\n   * **Only consider original posts by the author.**\n\n   #### **Ranking Criteria**\n\n   * **Relevance to business, professional achievements, company milestones, hiring, launches, or insightful commentary** is prioritized.\n   * **Fresher (newer) posts are generally preferred**, but quality/relevance always outweighs recency.\n   * **Avoid posts that are generic (e.g. \u201cHappy New Year\u201d, \u201cLooking forward to the weekend\u201d)** unless nothing else is available.\n   * **If all posts are unsuitable, do not invent or hallucinate content\u2014explicitly state \u201cNo suitable post found.\u201d**\n\n2. **Summarize the content of the selected post in 5-15 words.**\n\n   * Focus on the main point or highlight (not word-for-word copying).\n   * Be specific: capture what the post was about (e.g., a company expansion, a hiring win, a product launch, etc).\n   * Avoid any direct copy-paste, hashtags, or links in your summary.\n   * Use natural language; do not use quotation marks unless absolutely necessary.\n\n3. **Compose the personalized line as follows:**\n\n   * Start **exactly** with: `Saw your LinkedIn post about`\n   * Append a concise summary of the post as described above.\n   * The entire line (prefix + summary) **should not exceed 20 words.**\n   * The tone must be professional, friendly, and sound like a real person who read the post.\n\n4. **Output format:**\n\n   * If a post was selected, return:\n\n     ```json\n     {\n       \"opener\": \"Saw your LinkedIn post about {concise summary}\"\n     }\n     ```\n   * If **no suitable post is found**, return:\n\n     ```json\n     {\n       \"opener\": \"No suitable post found.\"\n     }\n     ```\n\n---\n\n### Examples\n\n**Input:** (as JSON)\n\n```json\n{\n  \"posts\": [\n    {\n      \"text\": \"Excited to announce we've opened our first US office in Austin, TX!\",\n      \"post_type\": \"regular\",\n      \"posted_at\": { \"date\": \"2024-12-01 10:00:00\" }\n    },\n    {\n      \"text\": \"Happy Friday everyone!\",\n      \"post_type\": \"regular\",\n      \"posted_at\": { \"date\": \"2024-12-08 09:00:00\" }\n    },\n    {\n      \"text\": \"Reshared an insightful article on climate policy.\",\n      \"post_type\": \"repost\",\n      \"posted_at\": { \"date\": \"2024-12-09 10:00:00\" }\n    }\n  ]\n}\n```\n\n**Output:**\n\n```json\n{\n  \"opener\": \"Saw your LinkedIn post about opening your first US office in Austin.\"\n}\n```\n\n---\n\n**Input:** (as JSON)\n\n```json\n{\n  \"posts\": [\n    {\n      \"text\": \"Looking forward to the weekend!\",\n      \"post_type\": \"regular\",\n      \"posted_at\": { \"date\": \"2024-12-01 10:00:00\" }\n    },\n    {\n      \"text\": \"Shared a political opinion.\",\n      \"post_type\": \"regular\",\n      \"posted_at\": { \"date\": \"2024-12-08 09:00:00\" }\n    }\n  ]\n}\n```\n\n**Output:**\n\n```json\n{\n  \"opener\": \"No suitable post found.\"\n}\n```\n\n---\n\n### Final Notes\n\n* **Never reference multiple posts in a single opener.**\n* **Always use the exact phrasing for the prefix.**\n* **Do not copy and paste text verbatim from the post.**\n* **If in doubt about suitability, err on the side of exclusion.**\n* **Never generate made-up summaries or facts.**\n* **If all posts are filtered out, return \"No suitable post found.\"**\n\n---\n\n**Your input will be a JSON with a `posts` array, as above. Output only the JSON opener as described.**\n"
            },
            {
              "content": "=Posts: {{ $('Merge Posts To 1 Item').first().json.merged_posts }}\nToday's date: {{ $now }}"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "93e14270-8827-4085-a755-72eaeac8e4f1",
      "name": "Merge Posts To 1 Item",
      "type": "n8n-nodes-base.code",
      "position": [
        -128,
        -464
      ],
      "parameters": {
        "jsCode": "// Assume input is an array of post objects (from previous node)\n// n8n passes each item as { json: { ...post } }, so get all items\nconst items = $input.all();\n\nconst mergedText = items.map(item => {\n  const p = item.json;\n  return [\n    `Author: ${p.author?.first_name || ''} ${p.author?.last_name || ''}`.trim(),\n    `Date: ${p.posted_at?.date || ''}`,\n    `Type: ${p.post_type || ''}`,\n    `Text: ${p.text || ''}`,\n    `URL: ${p.url || ''}`\n  ].filter(Boolean).join('\\n');\n}).join('\\n---\\n');\n\nreturn [\n  {\n    json: {\n      merged_posts: mergedText\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "74784a9b-e9d6-4159-b9f4-6341d6287db6",
      "name": "Suitable Posts?",
      "type": "n8n-nodes-base.if",
      "position": [
        2240,
        -848
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "19bb2711-05c0-4149-84f6-35b1eaae0817",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.message.content.opener }}",
              "rightValue": "No suitable post found."
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "715a671e-f4dd-487a-a296-34058d6e6f6e",
      "name": "Update Lead W/ Enrichment - Line",
      "type": "n8n-nodes-base.airtable",
      "notes": "{{ $json.query.recordId }}",
      "position": [
        2528,
        -1040
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableBaseId\"] }}"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableTargetTableId\"] }}"
        },
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "c69c6184-c6cf-4119-8f22-c629d9f412f0",
      "name": "Upload Lead To Instantly - Line",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2528,
        -864
      ],
      "parameters": {
        "url": "https://api.instantly.ai/api/v2/leads",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "jsonBody": "={\n  \"campaign\": \"{{$node[\"Configure Variables\"].json[\"instantlyCampaignId\"]}}\",\n  \"email\": \"{{ $('Pull Lead From Airtable').first().json['Email Address'] }}\",\n  \"personalization\": \"\",\n  \"website\": \"{{ $('Pull Lead From Airtable').first().json['Website URL'] }}\",\n  \"last_name\": \"\",\n  \"first_name\": \"{{ $('Pull Lead From Airtable').first().json['First Name'] }}\",\n  \"company_name\": \"{{ $('Pull Lead From Airtable').first().json['Company Name'] }}\",\n  \"phone\": \"{{ $('Pull Lead From Airtable').first().json.Phone }}\",\n  \"skip_if_in_workspace\": false,\n  \"skip_if_in_campaign\": true,\n  \"skip_if_in_list\": true,\n  \"custom_variables\": {\n    \"industry\": \"{{ $json.message.content.industry }}\",\n    \"unique_strength_or_feature\": \"{{ $json.message.content.unique_strength_or_feature }}\"\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer [YOUR INSTANTLY API KEY]"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "59ee55c3-e99d-4b76-8136-3e3d4361f698",
      "name": "Posts Available?.",
      "type": "n8n-nodes-base.if",
      "position": [
        3904,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f232b79d-b540-4236-aae8-ed92285a626b",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $('Scrape Personal LinkedIn Posts').first().json.message }}",
              "rightValue": "No posts found for this profile"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "8bd34155-eaae-4297-915f-b8af1fefbfa2",
      "name": "Craft Opening Line - Posts.",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        4128,
        -176
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "GPT-4.1"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=## Prompt: Personalized LinkedIn Post Opener Generation\n\nYou are a world-class AI assistant specialized in writing high-converting personalized cold outreach openers.\n\nYou will receive a JSON object with a property called `posts`. This property contains an array of LinkedIn post objects. Each object includes, at minimum, a `text`, `post_type`, `url`, and `posted_at.date`. Some posts may also include fields such as `author`, `reshared_post`, etc.\n\n---\n\n### Your Task\n\n1. **Select the single most relevant post to reference in a cold outreach message.**\n   Carefully consider all posts and apply the following strict filtering and ranking criteria:\n\n   #### **Hard Filtering Criteria**\n\n   * **Exclude all reposts or reshares** (`post_type` is `repost`, or posts with a `reshared_post` field).\n   * **Exclude posts about politics, religion, or controversial topics.**\n   * **Exclude posts with little substance (less than 15 words, or pure memes/quotes).**\n   * **Only consider original posts by the author.**\n\n   #### **Ranking Criteria**\n\n   * **Relevance to business, professional achievements, company milestones, hiring, launches, or insightful commentary** is prioritized.\n   * **Fresher (newer) posts are generally preferred**, but quality/relevance always outweighs recency.\n   * **Avoid posts that are generic (e.g. \u201cHappy New Year\u201d, \u201cLooking forward to the weekend\u201d)** unless nothing else is available.\n   * **If all posts are unsuitable, do not invent or hallucinate content\u2014explicitly state \u201cNo suitable post found.\u201d**\n\n2. **Summarize the content of the selected post in 5-15 words.**\n\n   * Focus on the main point or highlight (not word-for-word copying).\n   * Be specific: capture what the post was about (e.g., a company expansion, a hiring win, a product launch, etc).\n   * Avoid any direct copy-paste, hashtags, or links in your summary.\n   * Use natural language; do not use quotation marks unless absolutely necessary.\n\n3. **Compose the personalized line as follows:**\n\n   * Start **exactly** with: `Saw your LinkedIn post about`\n   * Append a concise summary of the post as described above.\n   * The entire line (prefix + summary) **should not exceed 20 words.**\n   * The tone must be professional, friendly, and sound like a real person who read the post.\n\n4. **Output format:**\n\n   * If a post was selected, return:\n\n     ```json\n     {\n       \"opener\": \"Saw your LinkedIn post about {concise summary}\"\n     }\n     ```\n   * If **no suitable post is found**, return:\n\n     ```json\n     {\n       \"opener\": \"No suitable post found.\"\n     }\n     ```\n\n---\n\n### Examples\n\n**Input:** (as JSON)\n\n```json\n{\n  \"posts\": [\n    {\n      \"text\": \"Excited to announce we've opened our first US office in Austin, TX!\",\n      \"post_type\": \"regular\",\n      \"posted_at\": { \"date\": \"2024-12-01 10:00:00\" }\n    },\n    {\n      \"text\": \"Happy Friday everyone!\",\n      \"post_type\": \"regular\",\n      \"posted_at\": { \"date\": \"2024-12-08 09:00:00\" }\n    },\n    {\n      \"text\": \"Reshared an insightful article on climate policy.\",\n      \"post_type\": \"repost\",\n      \"posted_at\": { \"date\": \"2024-12-09 10:00:00\" }\n    }\n  ]\n}\n```\n\n**Output:**\n\n```json\n{\n  \"opener\": \"Saw your LinkedIn post about opening your first US office in Austin.\"\n}\n```\n\n---\n\n**Input:** (as JSON)\n\n```json\n{\n  \"posts\": [\n    {\n      \"text\": \"Looking forward to the weekend!\",\n      \"post_type\": \"regular\",\n      \"posted_at\": { \"date\": \"2024-12-01 10:00:00\" }\n    },\n    {\n      \"text\": \"Shared a political opinion.\",\n      \"post_type\": \"regular\",\n      \"posted_at\": { \"date\": \"2024-12-08 09:00:00\" }\n    }\n  ]\n}\n```\n\n**Output:**\n\n```json\n{\n  \"opener\": \"No suitable post found.\"\n}\n```\n\n---\n\n### Final Notes\n\n* **Never reference multiple posts in a single opener.**\n* **Always use the exact phrasing for the prefix.**\n* **Do not copy and paste text verbatim from the post.**\n* **If in doubt about suitability, err on the side of exclusion.**\n* **Never generate made-up summaries or facts.**\n* **If all posts are filtered out, return \"No suitable post found.\"**\n\n---\n\n**Your input will be a JSON with a `posts` array, as above. Output only the JSON opener as described.**\n"
            },
            {
              "content": "=Posts: {{ $('Merge Posts To 1 Item').first().json.merged_posts }}\nToday's date: {{ $now }}"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "3a0fb68f-234a-409c-bcf4-1146ed1f0ea4",
      "name": "Suitable Posts?.",
      "type": "n8n-nodes-base.if",
      "position": [
        4480,
        -176
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "19bb2711-05c0-4149-84f6-35b1eaae0817",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.message.content.opener }}",
              "rightValue": "No suitable post found."
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "570184cb-7e79-4cfb-8389-15a4a237ab4b",
      "name": "Update Lead W/ Enrichment. - Line",
      "type": "n8n-nodes-base.airtable",
      "position": [
        4784,
        -384
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableBaseId\"] }}"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $node[\"Configure Variables\"].json[\"airtableTargetTableId\"] }}"
        },
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a9af25f2-7420-4c4a-b0ff-f412daf53582",
      "name": "Upload Lead To Instantly. - Line",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4784,
        -208
      ],
      "parameters": {
        "url": "https://api.instantly.ai/api/v2/leads",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "jsonBody": "={\n  \"campaign\": \"{{$node[\"Configure Variables\"].json[\"instantlyCampaignId\"]}}\",\n  \"email\": \"{{ $('Pull Lead From Airtable').first().json['Email Address'] }}\",\n  \"personalization\": \"\",\n  \"website\": \"{{ $('Pull Lead From Airtable').first().json['Company Website'] }}\",\n  \"last_name\": \"\",\n  \"first_name\": \"{{ $('Pull Lead From Airtable').first().json['First Name'] }}\",\n  \"company_name\": \"{{ $('Clean Company Name.').item.json.message.content }}\",\n  \"phone\": \"{{ $('Pull Lead From Airtable').first().json.Phone }}\",\n  \"skip_if_in_workspace\": false,\n  \"skip_if_in_campaign\": true,\n  \"skip_if_in_list\": true,\n  \"custom_variables\": {\n    \"CompanyOverview\": \"{{ $json.message.content.CompanyOverview }}\",\n    \"ICPofLead\": \"{{ $json.message.content.ICPofLead }}\",\n    \"PainPointLeadSolves\": \"{{ $json.message.content.PainPointLeadSolves }}\",\n    \"industry\": \"{{ $json.message.content.Industry }}\"\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer [YOUR INSTANTLY API KEY]"
            }
          ]
        }
      },
      "typeVersion": 4.2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2db904d4-d832-4e28-906a-b79ee6fa72a0",
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "LinkedIn Company Scraper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Configure Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Remove HTML Webpages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Valid?": {
      "main": [
        [
          {
            "node": "US: Yes or No?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Lead - No Valid Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If Empty": {
      "main": [
        [
          {
            "node": "Unable To Scrape Website?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JSON Into Text": {
      "main": [
        [
          {
            "node": "Analyze Personal LinkedIn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "US: Yes or No?": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Lead - Not US",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "B2B: Yes or No?": {
      "main": [
        [
          {
            "node": "Headcount: >5, <30?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Lead - Not B2B",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Suitable Posts?": {
      "main": [
        [
          {
            "node": "Upload Lead To Instantly - Line",
            "type": "main",
            "index": 0
          },
          {
            "node": "Update Lead W/ Enrichment - Line",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Lead W/ Enrichment",
            "type": "main",
            "index": 0
          },
          {
            "node": "Upload Lead To Instantly",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Posts Available?": {
      "main": [
        [
          {
            "node": "Craft Opening Line - Posts",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Lead W/ Enrichment",
            "type": "main",
            "index": 0
          },
          {
            "node": "Upload Lead To Instantly",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Suitable Posts?.": {
      "main": [
        [
          {
            "node": "Upload Lead To Instantly. - Line",
            "type": "main",
            "index": 0
          },
          {
            "node": "Update Lead W/ Enrichment. - Line",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Lead W/ Enrichment.",
            "type": "main",
            "index": 0
          },
          {
            "node": "Upload Lead To Instantly.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Posts Available?.": {
      "main": [
        [
          {
            "node": "Craft Opening Line - Posts.",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Lead W/ Enrichment.",
            "type": "main",
            "index": 0
          },
          {
            "node": "Upload Lead To Instantly.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Company Name": {
      "main": [
        [
          {
            "node": "Determine Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Company Name.": {
      "main": [
        [
          {
            "node": "Determine Variables.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configure Variables": {
      "main": [
        [
          {
            "node": "Pull Lead From Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Determine Variables": {
      "main": [
        [
          {
            "node": "Posts Available?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Headcount: >5, <30?": {
      "main": [
        [
          {
            "node": "Analyze Company LinkedIn",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Lead - Too Big or Small",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Turn X Items Into 1": {
      "main": [
        [
          {
            "node": "Determine Valuable URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Determine Variables.": {
      "main": [
        [
          {
            "node": "Posts Available?.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter HTML For URLs": {
      "main": [
        [
          {
            "node": "Turn X Items Into 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove HTML Homepage": {
      "main": [
        [
          {
            "node": "Check If Empty",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove HTML Webpages": {
      "main": [
        [
          {
            "node": "Remove Duplicates Texts C/M",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Posts To 1 Item": {
      "main": [
        [
          {
            "node": "Company Homepage Scraper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Company/Mission": {
      "main": [
        [
          {
            "node": "Remove Duplicates Texts O/P",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Determine Valuable URLs": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pull Lead From Airtable": {
      "main": [
        [
          {
            "node": "Email Validation - NeverBounce",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Company LinkedIn": {
      "main": [
        [
          {
            "node": "LinkedIn Profile Scraper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Proof Of Success": {
      "main": [
        [
          {
            "node": "Clean Company Name.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Company Homepage Scraper": {
      "main": [
        [
          {
            "node": "Remove HTML Homepage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LinkedIn Company Scraper": {
      "main": [
        [
          {
            "node": "Remove HTML LinkedIn Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LinkedIn Profile Scraper": {
      "main": [
        [
          {
            "node": "JSON Into Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Company LinkedIn_": {
      "main": [
        [
          {
            "node": "B2B: Yes or No?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Personal LinkedIn": {
      "main": [
        [
          {
            "node": "Scrape Personal LinkedIn Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove HTML LinkedIn Page": {
      "main": [
        [
          {
            "node": "Analyze Company LinkedIn_",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Unable To Scrape Website?": {
      "main": [
        [
          {
            "node": "Clean Company Name",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Filter HTML For URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Craft Opening Line - Posts": {
      "main": [
        [
          {
            "node": "Suitable Posts?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Craft Opening Line - Posts.": {
      "main": [
        [
          {
            "node": "Suitable Posts?.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicates Texts C/M": {
      "main": [
        [
          {
            "node": "Analyze Company/Mission",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicates Texts O/P": {
      "main": [
        [
          {
            "node": "Analyze Offerings & Positioning",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicates Texts P/D": {
      "main": [
        [
          {
            "node": "Analyze Process & Differentiation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicates Texts PoS": {
      "main": [
        [
          {
            "node": "Analyze Proof Of Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Validation - NeverBounce": {
      "main": [
        [
          {
            "node": "Email Valid?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Personal LinkedIn Posts": {
      "main": [
        [
          {
            "node": "Merge Posts To 1 Item",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Offerings & Positioning": {
      "main": [
        [
          {
            "node": "Remove Duplicates Texts P/D",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Process & Differentiation": {
      "main": [
        [
          {
            "node": "Remove Duplicates Texts PoS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}