{
  "id": "03S1S3TyPxOWpBmX",
  "name": "Send Personalized Speed-to-Lead Email to Inbound Form Submissions",
  "tags": [],
  "nodes": [
    {
      "id": "73f5219f-5a7d-41dd-8f85-ce0195beb1aa",
      "name": "Create a record",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -496,
        1616
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "apptYepOjWlWnbFZc",
          "cachedResultUrl": "https://airtable.com/apptYepOjWlWnbFZc",
          "cachedResultName": "Inbound Leads v2"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblzqOUjbbvSQYy5v",
          "cachedResultUrl": "https://airtable.com/apptYepOjWlWnbFZc/tblzqOUjbbvSQYy5v",
          "cachedResultName": "Inbound Leads"
        },
        "columns": {
          "value": {
            "Role": "={{ $('key value pair').item.json.role }}",
            "Email": "={{ $('key value pair').item.json.email }}",
            "Goals": "={{ $('key value pair').item.json.notes }}",
            "Website": "={{ $('key value pair').item.json.website }}",
            "Last Name": "={{ $('key value pair').item.json.lastName }}",
            "First Name": "={{ $('key value pair').item.json.firstName }}",
            "Company Name": "={{ $('key value pair').item.json.company }}"
          },
          "schema": [
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Role",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Role",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Website",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Goals",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Goals",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Website summary",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Website summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Booked appointment?",
              "type": "boolean",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Booked appointment?",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Appointment date",
              "type": "dateTime",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Appointment date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Created",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Created",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Record ID",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Record ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "90a2fcba-68cd-4a82-8508-cca1e875aae5",
      "name": "Search records1",
      "type": "n8n-nodes-base.airtable",
      "position": [
        704,
        2144
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "apptYepOjWlWnbFZc",
          "cachedResultUrl": "https://airtable.com/apptYepOjWlWnbFZc",
          "cachedResultName": "Inbound Leads v2"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblzqOUjbbvSQYy5v",
          "cachedResultUrl": "https://airtable.com/apptYepOjWlWnbFZc/tblzqOUjbbvSQYy5v",
          "cachedResultName": "Inbound Leads"
        },
        "options": {},
        "operation": "search",
        "filterByFormula": "=LOWER({Email}) = \"{{ $json.email.toLowerCase() }}\""
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a1d9ebad-ad4d-46bc-85c7-aed0e57890ff",
      "name": "Update record",
      "type": "n8n-nodes-base.airtable",
      "position": [
        928,
        2144
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "apptYepOjWlWnbFZc",
          "cachedResultUrl": "https://airtable.com/apptYepOjWlWnbFZc",
          "cachedResultName": "Inbound Leads v2"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblzqOUjbbvSQYy5v",
          "cachedResultUrl": "https://airtable.com/apptYepOjWlWnbFZc/tblzqOUjbbvSQYy5v",
          "cachedResultName": "Inbound Leads"
        },
        "columns": {
          "value": {
            "Record ID": "={{ $json['Record ID'] }}",
            "Appointment date": "={{ $('Extract Appointment Date').item.json.eventDateTime }}",
            "Booked appointment?": true
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true
            },
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Role",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Role",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Website",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Goals",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Goals",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Website summary",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Website summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Booked appointment?",
              "type": "boolean",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Booked appointment?",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Appointment date",
              "type": "dateTime",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Appointment date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Created",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Created",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Record ID",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "Record ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Record ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "780ca756-232f-47cc-b4f7-4450bd14061f",
      "name": "scrape website",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        -304,
        1488
      ],
      "parameters": {
        "url": "=https://{{ $json.fields.Website }}",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/0.0.0.0 Safari/537.36"
            },
            {
              "name": "Accept-Language ",
              "value": "en-US,en;q=0.9"
            },
            {
              "name": "Accept",
              "value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
            },
            {
              "name": "Connection ",
              "value": "keep-alive"
            },
            {
              "name": "Upgrade-Insecure-Requests",
              "value": "1"
            },
            {
              "name": "Cache-Control",
              "value": "no-cache"
            },
            {
              "name": "Pragma",
              "value": "no-cache"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "9665fddb-34e7-4181-baf5-37c9c0efc2a0",
      "name": "Markdown",
      "type": "n8n-nodes-base.markdown",
      "position": [
        -64,
        1440
      ],
      "parameters": {
        "html": "={{ $json.data }}",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "f07157c1-bf9b-4dba-b8e0-dea8381f3ec7",
      "name": "Markdown1",
      "type": "n8n-nodes-base.markdown",
      "onError": "continueRegularOutput",
      "position": [
        -48,
        1808
      ],
      "parameters": {
        "html": "={{ $json.data }}",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "83228d54-f2bb-44a4-a5ad-d07edb3ebd6c",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        352,
        1616
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "36709a4d-122d-4eba-9b9e-1298d8654be9",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        608,
        1616
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "data"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "090e9bfb-9a29-4550-84de-f49c9de44c19",
      "name": "Summarizer",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        832,
        1616
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "GPT-4O"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=# Role\nYou are the worlds greatest summarizer and writer when it comes to taking in scraped website data and creating the best summary possible to let your boss know more about the new lead"
            },
            {
              "content": "=# Task\nExtract specific details from company data for personalized cold emails.\n\nCompany data: \n{{ $json.data }}\n\n\n# Find and include:\n- What they do (simple description)\n- EXACT NUMBERS (users, ratings, percentages, quantities)\n- CLIENT NAMES mentioned\n- SPECIFIC FEATURES with benefits\n- TESTIMONIALS with person titles\n- INTEGRATIONS mentioned\n- RATINGS/REVIEWS data\n\n# Format:\n\"[Company] does [what]. Key numbers: [specific metrics]. Notable clients: [names]. Standout features: [specific features with benefits]. Testimonials: [quote with title]. Integrations: [list]. Social proof: [ratings/reviews]. Best mentions: [list ALL specific things worth complimenting - client names, features, numbers, achievements, unique capabilities].\"\n\nOutput in \"summary\" field. Be specific - include all numbers, names, and quotes found.\n\n"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "419189cf-15d7-4682-b7dc-7b1dd4bb5d08",
      "name": "Compose personalized email",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1408,
        1616
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "GPT-4O"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "role": "system",
              "content": "=You are {YOUR BUSINESS INFO NAME ETC..} Write a brief, professional but friendly email following this EXACT template structure:\n\nTEMPLATE TO FOLLOW: (include the ending)\nHey [firstName], \n\nI just got your inquiry that you filled out on our website. I see that you {the goal they put make sure it flows}. Make sure to grab a time on the calendar if you haven't already. I had a chance to check out [Company Name]. [specific compliment based on website summary]. Looking forward to jumping on a call together. If you have any questions prior to the call, email me back here or text me at {YOUR NUMBER}.\"\n\n{HOWEVER YOU WANT TO END THE EMAIL}\n\nYOUR TASK:\nFill in these variables based on the input data:\n1. [their stated goal/need] - What they wrote in the form about what they need help with\n2. [Company Name] - Their company name\n3. [specific compliment] - ONE specific thing you noticed from their website summary (keep it brief and genuine)\n\nRULES FOR THE COMPLIMENT:\n- Must be specific to their business (not generic)\n- Keep it to 1 sentence or phrase\n- Examples: \"really impressive scale with 5M emails daily\" or \"love the deliverability focus with your warmup pool\" or \"the AI optimization tools look solid\"\n- Make it natural and conversational\n- EVERYTHING NEEDS TO FLOW SMOOTHLY AND MAKE SENSE LIKE A HUMAN TYPED IT\n_ THE COMPLIMENT NEEDS TO FLOW WITH THE EMAIL AND SOUND NATURAL \n\nWRITING STYLE:\n- Professional but casual\n- Friendly and welcoming (not salesy)\n- Brief and to the point\n- Natural tone (like you quickly typed this between meetings)\n\nOUTPUT FORMAT:\nReturn ONLY the email body text following the template exactly. No greeting like \"Hi [Name]\" (we add that separately). No signature block. Just fill in the template and return it.\n\nINPUT DATA YOU'LL RECEIVE:\n- Website Summary: Details about their company, products, features\n- Goals/Notes: What they said they need help with\n\nEXAMPLE OUTPUT:\n\"Just got your inquiry for discussing automation options. Make sure to grab a time on the calendar if you haven't already. I had a chance to check out Instantly and really impressive that you're handling 5M emails daily with that deliverability network. Looking forward to jumping on a call. If you have any questions prior to the call, email me back here or text me at {YOUR NUMBER HERE}.\"\n\n\n\n"
            },
            {
              "content": "=WEBSITE SUMMARY:\n{{ $('Summarizer').item.json.message.content.summary }}\n\nLEAD'S STATED GOALS:\n{{ $('key value pair').item.json.notes }}\n\nLEADS INFO: {{ JSON.stringify($json.fields) }}\n\nWrite the speed-to-lead email based on this."
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "09d5a65f-8fab-430b-9fbc-54d5586261d3",
      "name": "send email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1760,
        1616
      ],
      "parameters": {
        "sendTo": "={{ $('key value pair').item.json.email }}",
        "message": "={{ $json.output[0].content[0].text }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "=Hey {{ $('key value pair').item.json.firstName }} just got your inquiry!",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "d8be25f1-c5e8-482d-830c-ecb940ae4711",
      "name": " Add summary to airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1184,
        1616
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "apptYepOjWlWnbFZc",
          "cachedResultUrl": "https://airtable.com/apptYepOjWlWnbFZc",
          "cachedResultName": "Inbound Leads v2"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblzqOUjbbvSQYy5v",
          "cachedResultUrl": "https://airtable.com/apptYepOjWlWnbFZc/tblzqOUjbbvSQYy5v",
          "cachedResultName": "Inbound Leads"
        },
        "columns": {
          "value": {
            "Record ID": "={{ $('Create a record').item.json.fields['Record ID'] }}",
            "Website summary": "={{ $json.message.content.summary }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true
            },
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Role",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Role",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Website",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Goals",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Goals",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Website summary",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Website summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Booked appointment?",
              "type": "boolean",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Booked appointment?",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Created",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Created",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Record ID",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "Record ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Record ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a2f2faba-fdf3-4b65-9573-34099419a4d1",
      "name": " Clean markdown",
      "type": "n8n-nodes-base.code",
      "position": [
        144,
        1440
      ],
      "parameters": {
        "jsCode": "// Process all input items, not just the first one\nconst items = $input.all();\nconst results = [];\n\nitems.forEach((item, index) => {\n  const raw = item.json.data || \"\";\n  \n  // Define patterns to remove or clean\n  const cleaningPatterns = [\n    // Remove image markdown but preserve alt text for context\n    { pattern: /!\\[([^\\]]*)\\]\\([^)]*\\)/g, replacement: '$1' },\n    \n    // Remove URLs and links but preserve link text\n    { pattern: /\\[([^\\]]+)\\]\\([^)]*\\)/g, replacement: '$1' },\n    \n    // Remove standalone URLs\n    { pattern: /https?:\\/\\/[^\\s]+/g, replacement: '' },\n    \n    // Clean up markdown formatting characters\n    { pattern: /[#*_`>]+/g, replacement: '' },\n    \n    // Remove multiple dashes or underscores\n    { pattern: /[-_]{2,}/g, replacement: '' },\n    \n    // Remove email addresses\n    { pattern: /\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b/g, replacement: '' },\n    \n    // Clean up escaped characters\n    { pattern: /\\\\(.)/g, replacement: '$1' },\n    \n    // Remove excessive punctuation\n    { pattern: /[.,!?]{2,}/g, replacement: '.' }\n  ];\n\n  // Sections to completely remove (case-insensitive)\n  const sectionsToRemove = [\n    /toggle\\s+menu/gi,\n    /previous\\s+slide\\s*next/gi,\n    /log\\s+in/gi,\n    /sign\\s+up/gi,\n    /book\\s+a\\s+demo/gi,\n    /contact\\s+sales/gi,\n    /\u00a9.*202\\d/gi, // Copyright notices\n    /follow\\s+us/gi,\n    /social\\s+media/gi\n  ];\n\n  // Navigation and UI elements patterns\n  const uiPatterns = [\n    /^\\s*\\d+\\s*$/gm, // Standalone numbers (likely UI elements)\n    /^\\s*(docs|tickers|sources|think|send)\\s*$/gmi,\n    /^\\s*toggle\\s*$/gmi\n  ];\n\n  let cleaned = raw;\n\n  // Apply cleaning patterns\n  cleaningPatterns.forEach(({pattern, replacement}) => {\n    cleaned = cleaned.replace(pattern, replacement);\n  });\n\n  // Remove unwanted sections\n  sectionsToRemove.forEach(pattern => {\n    cleaned = cleaned.replace(pattern, '');\n  });\n\n  // Remove UI patterns\n  uiPatterns.forEach(pattern => {\n    cleaned = cleaned.replace(pattern, '');\n  });\n\n  // Normalize whitespace and structure\n  cleaned = cleaned\n    // Replace multiple spaces with single space\n    .replace(/[ \\t]+/g, ' ')\n    // Replace multiple newlines with double newline (paragraph breaks)\n    .replace(/\\n{3,}/g, '\\n\\n')\n    // Remove lines with only whitespace\n    .replace(/^\\s*$/gm, '')\n    // Remove leading/trailing whitespace from each line\n    .split('\\n').map(line => line.trim()).join('\\n')\n    // Remove empty lines at start and end\n    .replace(/^\\n+|\\n+$/g, '')\n    // Fix spacing around punctuation\n    .replace(/\\s+([.,!?])/g, '$1')\n    // Ensure space after punctuation\n    .replace(/([.,!?])([A-Za-z])/g, '$1 $2');\n\n  // Additional content-specific cleaning\n  cleaned = cleaned\n    // Remove redundant phrases\n    .replace(/see\\s+the\\s+benchmark\u2192?/gi, '')\n    .replace(/see\\s+all\\s+benchmarks?\u2192?/gi, '')\n    // Clean up percentage comparisons\n    .replace(/(\\w+)(\\d+%)/g, '$1 $2')\n    // Fix common spacing issues\n    .replace(/([a-z])([A-Z])/g, '$1 $2') // Add space between camelCase\n    .replace(/(\\w)(\\d)/g, '$1 $2') // Space between word and number\n    .replace(/(\\d)(\\w)/g, '$1 $2'); // Space between number and word\n\n  // Final cleanup - remove very short lines that are likely UI artifacts\n  const lines = cleaned.split('\\n').filter(line => {\n    const trimmed = line.trim();\n    // Keep lines that are either longer than 3 chars or contain meaningful content\n    return trimmed.length > 3 || /^[A-Z][A-Za-z\\s]+$/.test(trimmed);\n  });\n\n  cleaned = lines.join('\\n').trim();\n\n  // Add the processed item to results with proper n8n format\n  results.push({\n    json: {\n      ...item.json, // Preserve all original data\n      cleaned_markdown: cleaned,\n      original_length: raw.length,\n      cleaned_length: cleaned.length,\n      reduction_percent: Math.round((1 - cleaned.length / raw.length) * 100)\n    },\n    pairedItem: { item: index } // Maintain pairing\n  });\n});\n\n// Return all processed items\nreturn results;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "c55bc8b4-67f2-46d3-8f62-9ba225a8c72e",
      "name": " Clean markdown1",
      "type": "n8n-nodes-base.code",
      "position": [
        176,
        1808
      ],
      "parameters": {
        "jsCode": "// Process all input items, not just the first one\nconst items = $input.all();\nconst results = [];\n\nitems.forEach((item, index) => {\n  const raw = item.json.data || \"\";\n  \n  // Define patterns to remove or clean\n  const cleaningPatterns = [\n    // Remove image markdown but preserve alt text for context\n    { pattern: /!\\[([^\\]]*)\\]\\([^)]*\\)/g, replacement: '$1' },\n    \n    // Remove URLs and links but preserve link text\n    { pattern: /\\[([^\\]]+)\\]\\([^)]*\\)/g, replacement: '$1' },\n    \n    // Remove standalone URLs\n    { pattern: /https?:\\/\\/[^\\s]+/g, replacement: '' },\n    \n    // Clean up markdown formatting characters\n    { pattern: /[#*_`>]+/g, replacement: '' },\n    \n    // Remove multiple dashes or underscores\n    { pattern: /[-_]{2,}/g, replacement: '' },\n    \n    // Remove email addresses\n    { pattern: /\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b/g, replacement: '' },\n    \n    // Clean up escaped characters\n    { pattern: /\\\\(.)/g, replacement: '$1' },\n    \n    // Remove excessive punctuation\n    { pattern: /[.,!?]{2,}/g, replacement: '.' }\n  ];\n\n  // Sections to completely remove (case-insensitive)\n  const sectionsToRemove = [\n    /toggle\\s+menu/gi,\n    /previous\\s+slide\\s*next/gi,\n    /log\\s+in/gi,\n    /sign\\s+up/gi,\n    /book\\s+a\\s+demo/gi,\n    /contact\\s+sales/gi,\n    /\u00a9.*202\\d/gi, // Copyright notices\n    /follow\\s+us/gi,\n    /social\\s+media/gi\n  ];\n\n  // Navigation and UI elements patterns\n  const uiPatterns = [\n    /^\\s*\\d+\\s*$/gm, // Standalone numbers (likely UI elements)\n    /^\\s*(docs|tickers|sources|think|send)\\s*$/gmi,\n    /^\\s*toggle\\s*$/gmi\n  ];\n\n  let cleaned = raw;\n\n  // Apply cleaning patterns\n  cleaningPatterns.forEach(({pattern, replacement}) => {\n    cleaned = cleaned.replace(pattern, replacement);\n  });\n\n  // Remove unwanted sections\n  sectionsToRemove.forEach(pattern => {\n    cleaned = cleaned.replace(pattern, '');\n  });\n\n  // Remove UI patterns\n  uiPatterns.forEach(pattern => {\n    cleaned = cleaned.replace(pattern, '');\n  });\n\n  // Normalize whitespace and structure\n  cleaned = cleaned\n    // Replace multiple spaces with single space\n    .replace(/[ \\t]+/g, ' ')\n    // Replace multiple newlines with double newline (paragraph breaks)\n    .replace(/\\n{3,}/g, '\\n\\n')\n    // Remove lines with only whitespace\n    .replace(/^\\s*$/gm, '')\n    // Remove leading/trailing whitespace from each line\n    .split('\\n').map(line => line.trim()).join('\\n')\n    // Remove empty lines at start and end\n    .replace(/^\\n+|\\n+$/g, '')\n    // Fix spacing around punctuation\n    .replace(/\\s+([.,!?])/g, '$1')\n    // Ensure space after punctuation\n    .replace(/([.,!?])([A-Za-z])/g, '$1 $2');\n\n  // Additional content-specific cleaning\n  cleaned = cleaned\n    // Remove redundant phrases\n    .replace(/see\\s+the\\s+benchmark\u2192?/gi, '')\n    .replace(/see\\s+all\\s+benchmarks?\u2192?/gi, '')\n    // Clean up percentage comparisons\n    .replace(/(\\w+)(\\d+%)/g, '$1 $2')\n    // Fix common spacing issues\n    .replace(/([a-z])([A-Z])/g, '$1 $2') // Add space between camelCase\n    .replace(/(\\w)(\\d)/g, '$1 $2') // Space between word and number\n    .replace(/(\\d)(\\w)/g, '$1 $2'); // Space between number and word\n\n  // Final cleanup - remove very short lines that are likely UI artifacts\n  const lines = cleaned.split('\\n').filter(line => {\n    const trimmed = line.trim();\n    // Keep lines that are either longer than 3 chars or contain meaningful content\n    return trimmed.length > 3 || /^[A-Z][A-Za-z\\s]+$/.test(trimmed);\n  });\n\n  cleaned = lines.join('\\n').trim();\n\n  // Add the processed item to results with proper n8n format\n  results.push({\n    json: {\n      ...item.json, // Preserve all original data\n      cleaned_markdown: cleaned,\n      original_length: raw.length,\n      cleaned_length: cleaned.length,\n      reduction_percent: Math.round((1 - cleaned.length / raw.length) * 100)\n    },\n    pairedItem: { item: index } // Maintain pairing\n  });\n});\n\n// Return all processed items\nreturn results;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "8830237a-0713-401e-b207-479aebf1a2f7",
      "name": " Scrape website about page",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        -288,
        1792
      ],
      "parameters": {
        "url": "=https://{{ $json.fields.Website }}/about",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/0.0.0.0 Safari/537.36"
            },
            {
              "name": "Accept-Language ",
              "value": "en-US,en;q=0.9"
            },
            {
              "name": "Accept",
              "value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
            },
            {
              "name": "Connection ",
              "value": "keep-alive"
            },
            {
              "name": "Upgrade-Insecure-Requests",
              "value": "1"
            },
            {
              "name": "Cache-Control",
              "value": "no-cache"
            },
            {
              "name": "Pragma",
              "value": "no-cache"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f5004a49-6097-4df2-8f05-710928970409",
      "name": " If website errors ",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -64,
        1600
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "apptYepOjWlWnbFZc",
          "cachedResultUrl": "https://airtable.com/apptYepOjWlWnbFZc",
          "cachedResultName": "Inbound Leads v2"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblzqOUjbbvSQYy5v",
          "cachedResultUrl": "https://airtable.com/apptYepOjWlWnbFZc/tblzqOUjbbvSQYy5v",
          "cachedResultName": "Inbound Leads"
        },
        "columns": {
          "value": {
            "Record ID": "={{ $('Create a record').item.json.fields['Record ID'] }}",
            "Website summary": "invalid website"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true
            },
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Role",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Role",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Website",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Goals",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Goals",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Website summary",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Website summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Booked appointment?",
              "type": "boolean",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Booked appointment?",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Appointment date",
              "type": "dateTime",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Appointment date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Created",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Created",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Record ID",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "Record ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Record ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "fb32438a-5dc2-477d-8d88-487d0dd78307",
      "name": "have they filled a form already?",
      "type": "n8n-nodes-base.switch",
      "position": [
        -720,
        1360
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9c142b74-ee4f-4ee8-814c-3c0a3ecec3d1",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.Email }}",
                    "rightValue": ""
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "2c800987-acbf-4ce8-bf9d-4e8d43c187cd",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "",
                    "rightValue": ""
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "bb5e5203-56a4-4567-9fc5-1d11cff58f28",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -480,
        1168
      ],
      "parameters": {
        "sendTo": "={{ $json.Email }}",
        "message": "=Hey {{ $json['First Name'] }},\n\nI just got your inquiry but remembered that previously on {{ DateTime.fromISO($json.Created).toFormat('yyyy-MM-dd') }} you had already filled out a form where you said \"{{ $json.Goals }}\" looking forward to jumping on a call, go ahead and grab a time on my calendar if you haven't already. Also if you have any questions feel free to email me back here!\n\nJordan Austin | Founder | ZangFlow",
        "options": {
          "appendAttribution": false
        },
        "subject": "=Hey {{ $json['First Name'] }} just got your inquiry",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "fefa2885-56cb-47ec-a7be-2dff3fe48eaa",
      "name": "Send appointment confirmed",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1168,
        2144
      ],
      "parameters": {
        "sendTo": "={{ $json.fields.Email }}",
        "message": "=Hey {{ $json.fields[\"First Name\"] }},\n\nI just got your booking on: {{ DateTime.fromISO($json.fields[\"Appointment date\"]).toFormat('MMMM dd, yyyy \\'at\\' h:mm a ZZZZ') }} really looking forward to our call! If you have any questions prior or anything changes just shoot me a message back here!\n\nJordan Austin | Founder | ZangFlow",
        "options": {
          "appendAttribution": false
        },
        "subject": "=Confirmed appointment",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "18256748-8f51-4cc4-aa81-718618aeec91",
      "name": "Send a message2",
      "type": "n8n-nodes-base.gmail",
      "position": [
        112,
        1600
      ],
      "parameters": {
        "sendTo": "={{ $('key value pair').item.json.email }}",
        "message": "=Hey {{ $json['First Name'] }},\n\nI just got your inquiry from you form you had just filled out on our website. Looking forward to jumping on a call, go ahead and grab a time on my calendar if you haven't already. Also if you have any questions feel free to email me back here!\n\nJordan Austin | Founder | ZangFlow",
        "options": {
          "appendAttribution": false
        },
        "subject": "=Hey {{ $json['First Name'] }} just got your inquiry",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "6a691f3c-5e28-4ef6-86ad-243e1f337079",
      "name": " Covert time to ISO",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        128,
        2144
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "content": "=# Task\n\nextract the email and Extract the event date/time and format it as ISO 8601. from the snippet:\n{{ $json.snippet }}\n\n\nouput in 2 sepreate keys \n\nemail \n\neventDateTime\n\n\n\n\n\n\n"
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "b00cb6f4-9e2b-402e-830a-31a17601a489",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1680,
        1264
      ],
      "parameters": {
        "color": 7,
        "width": 704,
        "height": 288,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "b7174738-4c51-49fb-be56-fcce158d01b2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1664,
        1280
      ],
      "parameters": {
        "width": 672,
        "height": 256,
        "content": "## Potential client fills out form on website\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6da18454-f875-478f-9304-33119ef07295",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        1264
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 288,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2437fca2-5443-45b1-93b7-65c052cf4530",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        1280
      ],
      "parameters": {
        "color": 2,
        "width": 384,
        "height": 256,
        "content": "## Check if this person has filled out a form before "
      },
      "typeVersion": 1
    },
    {
      "id": "0848618b-1e86-4b70-bab6-b5679f51f224",
      "name": "Check to see if record exist already",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -928,
        1360
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "apptYepOjWlWnbFZc",
          "cachedResultUrl": "https://airtable.com/apptYepOjWlWnbFZc",
          "cachedResultName": "Inbound Leads v2"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblzqOUjbbvSQYy5v",
          "cachedResultUrl": "https://airtable.com/apptYepOjWlWnbFZc/tblzqOUjbbvSQYy5v",
          "cachedResultName": "Inbound Leads"
        },
        "options": {},
        "operation": "search",
        "filterByFormula": "=OR(   LOWER({Email}) = \"{{ $json.email.toLowerCase() }}\",   LOWER({Company Name}) = \"{{ $json.company.toLowerCase() }}\" )"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1,
      "alwaysOutputData": true
    },
    {
      "id": "1c8d4b97-e513-4182-9680-8785c10f58fb",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        1056
      ],
      "parameters": {
        "color": 7,
        "width": 512,
        "height": 320,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "3f926cb1-0a79-4d05-b10f-ea4125d488b0",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        1072
      ],
      "parameters": {
        "color": 3,
        "width": 480,
        "height": 288,
        "content": "## Send Already inquired email and notify team"
      },
      "typeVersion": 1
    },
    {
      "id": "d9529f4b-1208-4c16-b8e7-067dc11ffe48",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        1376
      ],
      "parameters": {
        "color": 7,
        "width": 1072,
        "height": 608,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "f8391a4e-8e8d-49a3-bd4b-a322fa9be58d",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        1392
      ],
      "parameters": {
        "color": 4,
        "width": 1040,
        "height": 576,
        "content": "## If new lead scrape website home page and about page if the about page exist \n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "01e99cc5-77da-427d-8948-a0830f166b1f",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        1376
      ],
      "parameters": {
        "color": 7,
        "width": 832,
        "height": 608,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "eb89cae7-8dbb-459c-8926-ce33ec96eb6f",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        1392
      ],
      "parameters": {
        "color": 5,
        "width": 800,
        "height": 576,
        "content": "## Summarize website data add summary to CRM \n### Feed in markdown form the website into an llm that summarizes the info"
      },
      "typeVersion": 1
    },
    {
      "id": "8bc20b69-645f-4a12-9757-d292cf2050a5",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1360,
        1392
      ],
      "parameters": {
        "color": 6,
        "width": 592,
        "height": 576,
        "content": "## Use website summary to draft and send personalized email "
      },
      "typeVersion": 1
    },
    {
      "id": "64793afe-166e-4914-b691-d87b681ed07d",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        1376
      ],
      "parameters": {
        "color": 7,
        "width": 624,
        "height": 608,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a14b447b-33bd-4268-a24c-3751693c6508",
      "name": "Email from calendly?",
      "type": "n8n-nodes-base.switch",
      "position": [
        -304,
        2144
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "d645970e-3407-41a5-9a36-3b2a061ec6f7",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.From }}",
                    "rightValue": "Calendly <user@example.com>"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "e8d9d2ee-b2ed-41af-b43c-47de151a261e",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "",
                    "rightValue": ""
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "ab2adafa-cba9-4839-852a-4d2a59b8cfdd",
      "name": "Booking email?",
      "type": "n8n-nodes-base.switch",
      "position": [
        -96,
        2144
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9b70e49e-f5df-4fa9-95d4-af265597d023",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.Subject }}",
                    "rightValue": "New Event"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "25d4840c-7ed8-4e7c-9a6f-f28b3c39c5f7",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "",
                    "rightValue": ""
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "c2763a75-ab3c-4b14-8f5b-ba5b1a7db6ef",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        1984
      ],
      "parameters": {
        "color": 7,
        "width": 656,
        "height": 416,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "f4e1b775-5901-4e2c-95b7-7e846b70c77b",
      "name": "Watch for booking email",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -496,
        2144
      ],
      "parameters": {
        "filters": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "df769c1f-9c9a-4652-b1c1-6ff5f7d98414",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        2000
      ],
      "parameters": {
        "width": 624,
        "height": 384,
        "content": "## Watch inbox for calendly booking email"
      },
      "typeVersion": 1
    },
    {
      "id": "65eb81ca-78c1-4c8b-a053-cb800b888ca9",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        1984
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 416,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2cf4c422-6333-43d8-b7a3-e5c5b52edeff",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        2000
      ],
      "parameters": {
        "color": 3,
        "width": 528,
        "height": 384,
        "content": "## Extract appointment data and time "
      },
      "typeVersion": 1
    },
    {
      "id": "10cf70f3-0049-4795-b13f-d7279a243045",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        672,
        2000
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 384,
        "content": "## Add appointment time to CRM record "
      },
      "typeVersion": 1
    },
    {
      "id": "70082738-1014-4c1a-aedb-f00a514c93d7",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        1984
      ],
      "parameters": {
        "color": 7,
        "width": 720,
        "height": 416,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "7eeda6d1-d823-4bb4-b353-03099343d382",
      "name": "Sticky Note18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1088,
        2000
      ],
      "parameters": {
        "color": 5,
        "width": 272,
        "height": 384,
        "content": "## Send email telling inquiry we got the booked appointment "
      },
      "typeVersion": 1
    },
    {
      "id": "6f0f1959-4a60-4d28-8604-b69373800bc2",
      "name": "Sticky Note21",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 2384,
        "height": 1344,
        "content": "@[Youtube](2ZU_2zSO27w)"
      },
      "typeVersion": 1
    },
    {
      "id": "59500447-d838-499b-a279-8e9486fae371",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1616,
        1360
      ],
      "parameters": {
        "path": "bcc30636-4ea2-4f2f-9ccf-ea0b7e81cfc0",
        "options": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "a25d15fb-43f9-40ea-8e8d-bfafc091f87b",
      "name": "Sticky Note22",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1456,
        1552
      ],
      "parameters": {
        "width": 896,
        "height": 1488,
        "content": "# Send Personalized Speed-to-Lead Email to Inbound Form Submissions\n## By: [Jordan Austin](https://www.skool.com/ai-growth-lab-4394/about?ref=5065ab28874b4325b44ef3ead8105722)\n## System overview\n### - This system captures every lead that fills out a form on your website. When a form is submitted, the workflow checks if the lead already exists in your database. If they do, the system sends an email letting them know you already received their previous inquiry. If the lead is brand new, the system pulls their website URL, scrapes the site, summarizes the key information, and uses that summary to generate a personalized follow up email that feels human. After the follow up email is sent, the system waits to see if the person books a call through your embedded calendar. When a booking comes in, the workflow sends a clean confirmation email so the lead knows everything is locked in. The goal of this system is to respond to 100 percent of leads instantly, remove manual follow up, and prevent missed opportunities.\n\n## Who's it for\n\nThis template is essential for any business relying on **inbound lead forms** (e.g., from a website, Typeform, or dedicated CRM forms) that wants to instantly impress new prospects. It is perfect for high-velocity sales teams, founders, and consultants who need to reduce the critical \"speed to lead\" time from hours to mere seconds by automating a highly personalized first contact.\n\n## How it works\n\nThis workflow is triggered instantly by a form submission (Webhook) and executes a multi-step personalization process in under a minute:\n1. **Intake and Logging:** It immediately logs the new lead's details (name, company, goals) into an Airtable CRM and checks for duplicate records.\n2. **Website Insight:** It scrapes the lead's provided website URL to gather comprehensive company information. The HTML content is cleaned up using custom JavaScript to remove all noise (navigation, footers, scripts, etc.).\n3. **AI Personalization:** The cleaned data is fed to **GPT-4o** which analyzes the content, summarizing key numbers, features, and achievements.\n4. **Instant Follow-up:** This summary, combined with the lead's stated goals, is used by the AI to compose a unique, human-sounding, and highly specific follow-up email.\n5. **CRM Update:** The personalized email is sent via Gmail, and the full website summary is logged back into the Airtable record for sales team review.\n6. **Appointment Tracking:** A separate, connected branch monitors your inbox for Calendly booking confirmations and automatically updates the lead\u2019s Airtable record with the confirmed appointment date and time.\n\n## How to set up\n\n1. **Airtable:** Create the necessary base and table structure for inbound leads. **CRITICAL:** You must replace the hardcoded Base and Table IDs with your own unique IDs in all Airtable nodes.\n2. **Webhook & Form Setup:**\n    * **This template was originally designed and tested using a form built with [Lovable](https://lovable.dev/).** The process was simple: the n8n Webhook URL was pasted directly into the form\u2019s submission endpoint in Lovable.\n    * **Special Note:** If you are using a different website builder or form tool (e.g., WordPress, Webflow, custom HTML), the setup for connecting the form data to the n8n Webhook might require custom code or an intermediate tool (like Zapier or Make) to correctly format the data into a single JSON object.\n3. **AI Personalization:** In the **Compose personalized email** node, replace the hardcoded placeholders for the signature/closing (e.g., `{YOUR NUMBER}`, `{HOWEVER YOU WANT TO END THE EMAIL}`) with generic instructions for the user.\n4. **Security Check:** Ensure all personal identifiers like Google Sheets IDs, real email addresses, and your personal signature are replaced with generic placeholders.\n\n## Apis needed\n### - [Airtable](https://docs.n8n.io/integrations/builtin/credentials/airtable/?utm_source=n8n_app&utm_medium=credential_settings&utm_campaign=create_new_credentials_modal)\n### - [OpenAI](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-langchain.openai/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=%40n8n%2Fn8n-nodes-langchain.openAi)\n### - [WATCH THIS TO LEARN HOW TO SET UP ALL GOOGLE APIS](https://youtube.com/shorts/FBRQNmCN0F8?feature=share)\n\n## Airtable Base\n## [Link to the Airtable base](https://airtable.com/appdQOiJbMCveHwt4/shrQr4RjDfw1e2Tn3)"
      },
      "typeVersion": 1
    },
    {
      "id": "a99bd418-9a7a-441b-8def-256c2c66c07f",
      "name": "This is whatever you use to notify your team",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -272,
        1168
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "71541645-4f11-4b44-8f2f-20458a9f9c15",
      "name": "Extract Appointment Date",
      "type": "n8n-nodes-base.code",
      "position": [
        480,
        2144
      ],
      "parameters": {
        "jsCode": "// The input is an array, so access the first item\nconst data = $input.all()[0].json;\n\n// Now navigate to the text\nconst responseText = data.output[0].content[0].text;\n\n// Remove markdown code blocks if present\nlet jsonStr = responseText;\nif (responseText.includes('```json')) {\n  jsonStr = responseText.split('```json')[1].split('```')[0];\n}\n\n// Clean and parse\njsonStr = jsonStr.trim();\nconst parsed = JSON.parse(jsonStr);\n\nreturn {\n  json: {\n    email: parsed.email,\n    eventDateTime: parsed.event_date_time || parsed.eventDateTime || parsed.event_datetime\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "d8942e73-e213-43a5-83e0-b964c9df1b27",
      "name": "Parse Webhook Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -1376,
        1360
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cac06c8e-8007-4f2e-8054-db7c34633f7a",
              "name": "body",
              "type": "string",
              "value": "={{ $json.body }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b3eea68d-3b32-48d2-b4ae-594729e86db3",
      "name": "key value pair",
      "type": "n8n-nodes-base.code",
      "position": [
        -1152,
        1360
      ],
      "parameters": {
        "jsCode": "// Robust parser for weirdly-wrapped payloads in n8n\nfunction toObject(input) {\n  if (input == null) return null;\n\n  // If it's a string, try to JSON.parse it, and recurse\n  if (typeof input === 'string') {\n    try {\n      const parsed = JSON.parse(input);\n      return toObject(parsed);\n    } catch {\n      return null; // string but not JSON\n    }\n  }\n\n  // If it's an array, take the first element and recurse\n  if (Array.isArray(input)) {\n    if (input.length === 0) return null;\n    return toObject(input[0]);\n  }\n\n  // If it's already an object, we're done\n  if (typeof input === 'object') {\n    return input;\n  }\n\n  return null;\n}\n\n// Try common locations\nconst raw =\n  $json.body ??\n  $json.payload ??\n  $json.data ??\n  $json.requestBody ??\n  $json; // last resort\n\nconst obj = toObject(raw);\n\nif (!obj || typeof obj !== 'object') {\n  throw new Error(\n    'Could not parse payload into an object. Saw: ' +\n    JSON.stringify(raw)?.slice(0, 250)\n  );\n}\n\nreturn [{ json: obj }];\n\n\n"
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "aa82a7b2-c509-4e35-a1ea-c78f96ef171d",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Parse Webhook Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Markdown": {
      "main": [
        [
          {
            "node": " Clean markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Summarizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Markdown1": {
      "main": [
        [
          {
            "node": " Clean markdown1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarizer": {
      "main": [
        [
          {
            "node": " Add summary to airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update record": {
      "main": [
        [
          {
            "node": "Send appointment confirmed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Booking email?": {
      "main": [
        [
          {
            "node": " Covert time to ISO",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        [
          {
            "node": "This is whatever you use to notify your team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "key value pair": {
      "main": [
        [
          {
            "node": "Check to see if record exist already",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "scrape website": {
      "main": [
        [
          {
            "node": "Markdown",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": " If website errors ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    " Clean markdown": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a record": {
      "main": [
        [
          {
            "node": "scrape website",
            "type": "main",
            "index": 0
          },
          {
            "node": " Scrape website about page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search records1": {
      "main": [
        [
          {
            "node": "Update record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    " Clean markdown1": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Parse Webhook Data": {
      "main": [
        [
          {
            "node": "key value pair",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    " Covert time to ISO": {
      "main": [
        [
          {
            "node": "Extract Appointment Date",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    " If website errors ": {
      "main": [
        [
          {
            "node": "Send a message2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email from calendly?": {
      "main": [
        [
          {
            "node": "Booking email?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Watch for booking email": {
      "main": [
        [
          {
            "node": "Email from calendly?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    " Add summary to airtable": {
      "main": [
        [
          {
            "node": "Compose personalized email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Appointment Date": {
      "main": [
        [
          {
            "node": "Search records1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    " Scrape website about page": {
      "main": [
        [
          {
            "node": "Markdown1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compose personalized email": {
      "main": [
        [
          {
            "node": "send email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "have they filled a form already?": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create a record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check to see if record exist already": {
      "main": [
        [
          {
            "node": "have they filled a form already?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}