{
  "updatedAt": "2025-12-23T06:47:00.033Z",
  "createdAt": "2025-12-22T08:19:27.269Z",
  "id": "NIszPenQsngomHmX",
  "name": "leads",
  "description": null,
  "active": false,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "path": "4e580c61-5a9e-477e-84a2-ac21e497f238",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -608,
        -2160
      ],
      "id": "ebdd2820-0dd3-4ca0-9c38-fbc145cd323e",
      "name": "Webhook"
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={\n  \"canonical\": {\n    \"id\": \"{{$json.body.id || $execution.id}}\",\n    \"trace_id\": \"{{$execution.id}}\",\n    \"event_id\": \"{{$now.toISO()}}\",\n    \"tenant_id\": \"greenline365\",\n    \"source\": \"website_form\",\n    \"mode\": \"production\",\n    \"name\": \"{{$json.body.name || 'Unknown'}}\",\n    \"email\": \"{{$json.body.email}}\",\n    \"phone\": \"{{$json.body.phone || ''}}\",\n    \"company\": \"{{$json.body.company || ''}}\",\n    \"consent\": {\n      \"marketing\": true,\n      \"timestamp\": \"{{$now.toISO()}}\"\n    },\n    \"stage\": \"new_lead\",\n    \"created_at\": \"{{$now.toISO()}}\",\n    \"updated_at\": \"{{$now.toISO()}}\"\n  }\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -1312,
        -912
      ],
      "id": "1ed1dd99-770f-4bd2-a572-17c966669b74",
      "name": "NTC"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -1648,
        -912
      ],
      "id": "79b57c9e-21ca-4afd-9c18-ab0451b9184f",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "41bc8c97-5f0b-4364-ad55-1b565097812e",
              "leftValue": "=={{ $('GL365-brain').all().length }}",
              "rightValue": "0",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        -688,
        -912
      ],
      "id": "3d7a76e1-5c41-4f1a-b0d1-e3b46b36d3d6",
      "name": "If"
    },
    {
      "parameters": {
        "useCustomSchema": true,
        "operation": "getAll",
        "tableId": "leads",
        "filters": {
          "conditions": [
            {
              "keyName": "email",
              "condition": "eq",
              "keyValue": "={{ $json.canonical.email }}"
            },
            {
              "keyName": "phone",
              "condition": "eq",
              "keyValue": "={{ $json.canonical.phone }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        -1472,
        -912
      ],
      "id": "363bd4a4-f059-4ebb-86d0-3d9cc920a7b5",
      "name": "GL365-brain",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "jared.tucker13@gmaim.com",
        "subject": "new lead",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        -112,
        -1040
      ],
      "id": "ab38cdf1-60c3-408e-9b25-a1c5d25676a8",
      "name": "Send a message1",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "formTitle": "Lead Machine",
        "formDescription": "Provide the Info Below",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Business Type",
              "placeholder": "e.g. Plumber",
              "requiredField": true
            },
            {
              "fieldLabel": "Location",
              "placeholder": "e.g. Rome, Italy",
              "requiredField": true
            },
            {
              "fieldLabel": "Lead Number",
              "fieldType": "number",
              "requiredField": true
            },
            {
              "fieldLabel": "Email Style",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Friendly"
                  },
                  {
                    "option": "Professional"
                  },
                  {
                    "option": "Simple"
                  }
                ]
              }
            }
          ]
        },
        "options": {
          "appendAttribution": false,
          "buttonLabel": "GO \ud83d\ude80"
        }
      },
      "id": "b85457cf-451b-4a45-adb0-637a1a75da1a",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1120,
        -2544
      ],
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "url": "=Apify_Actor_Endpoint_URL",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n    \"includeWebResults\": false,\n    \"language\": \"en\",\n    \"locationQuery\": \"{{ $json.Location }}\",\n    \"maxCrawledPlacesPerSearch\": {{ $json['Lead Number'] }},\n    \"maxImages\": 0,\n    \"maximumLeadsEnrichmentRecords\": 0,\n    \"scrapeContacts\": false,\n    \"scrapeDirectories\": false,\n    \"scrapeImageAuthors\": false,\n    \"scrapePlaceDetailPage\": false,\n    \"scrapeReviewsPersonalData\": true,\n    \"scrapeTableReservationProvider\": false,\n    \"searchStringsArray\": [\n        \"{{ $json['Business Type'] }}\"\n    ],\n    \"skipClosedPlaces\": false\n}",
        "options": {}
      },
      "id": "4b930342-be3c-41a2-802a-843c1c504082",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -864,
        -2544
      ],
      "typeVersion": 4.2
    },
    {
      "parameters": {
        "text": "=Website: {{ $json.website }}",
        "attributes": {
          "attributes": [
            {
              "name": "Email Address",
              "description": "=find out the best only one email address from the website after scraping the website. The mail address have to be in ideal format.",
              "required": true
            }
          ]
        },
        "options": {}
      },
      "id": "a77f2306-e179-4fc1-b226-a0ae3fe483cb",
      "name": "Information Extractor",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        -1248,
        -2192
      ],
      "typeVersion": 1.2
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "492f7063-0b63-4d2c-ab92-9a2247237de9",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -1152,
        -2048
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0906e21a-0958-433e-b400-8694915ef3c9",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.website }}",
              "rightValue": ""
            }
          ]
        },
        "options": {}
      },
      "id": "225d6321-a403-4cae-89d0-77dd104f473d",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        -608,
        -2544
      ],
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1LmOvSzCOAlrgxQg5r77eVkyJWw3V0VDUAWgkoHWql1Y",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LmOvSzCOAlrgxQg5r77eVkyJWw3V0VDUAWgkoHWql1Y/edit?usp=drivesdk",
          "cachedResultName": "n8n Test"
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LmOvSzCOAlrgxQg5r77eVkyJWw3V0VDUAWgkoHWql1Y/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "columns": {
          "value": {
            "Address": "={{ $('Filter').item.json.address }}",
            "Website": "={{ $('Filter').item.json.website }}",
            "Category": "={{ $('Filter').item.json.categoryName }}",
            "Company Name": "={{ $('Filter').item.json.title }}",
            "Email Address": "={{ $json.output['Email Address'] }}",
            "Phone Nummber": "={{ $('Filter').item.json.phoneUnformatted }}"
          },
          "schema": [
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Website",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone Nummber",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone Nummber",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email Address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Cold Mail Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Cold Mail Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "SEND Time",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "SEND Time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "id": "96e23419-6fc4-4b3a-b577-8e45cc0424cb",
      "name": "Append row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -544,
        -2208
      ],
      "typeVersion": 4.6
    },
    {
      "parameters": {},
      "id": "7d51c99f-246c-4467-8f48-5f6736639d32",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -736,
        -2112
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "content": "# Getting the Email Address",
        "height": 368,
        "width": 1136,
        "color": 4
      },
      "id": "7b99b519-c058-4c88-9ef5-b90dc931d0c3",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1376,
        -2240
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "sendTo": "={{ $json['Email Address'] }}",
        "subject": "={{ $('Information Extractor1').item.json.output['Mail Subject'] }}",
        "emailType": "text",
        "message": "={{ $('Information Extractor1').item.json.output['Mail Body'] }}",
        "options": {
          "appendAttribution": false
        }
      },
      "id": "f95bf320-c46c-4d49-86e3-49db1832b9d9",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "maxTries": 2,
      "position": [
        -176,
        -1776
      ],
      "executeOnce": false,
      "retryOnFail": false,
      "typeVersion": 2.1,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "text": "=You are a perfect cold mail generator for a Digital Marketing Agency named Upward Engine.\n\nHere's the Information about the Recipient:\n\nCompany Name: {{ $('Loop Over Items').item.json['Company Name'] }}\nBusiness Type: {{ $('Loop Over Items').item.json.Category }}\n\nEmail Style / Email Tune : {{ $json['Email Style'] }}\n\nThe Email style is given just to understand how the mail will be.\n\nInstructions:\n\n1. Always start with giving a greting to the Company like Hi Company Name,\n2. Always use We not I.\n3. Mail have to be professional, Clean and to the point\n4. At last give a Signeture Like:\n   [Your Name]\n  [Your Company/Agency Name]",
        "attributes": {
          "attributes": [
            {
              "name": "Mail Subject",
              "description": "Eye catchy mail Subject for the cold mail",
              "required": true
            },
            {
              "name": "Mail Body",
              "description": "=body message of the mail, a perfect and clear cold mail.",
              "required": true
            }
          ]
        },
        "options": {}
      },
      "id": "12a72867-21d5-40dd-b3ee-bb9ebdd11d30",
      "name": "Information Extractor1",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        -832,
        -1776
      ],
      "typeVersion": 1.2
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "id": "7aa16a64-94db-4dd1-b12d-3eed8dd76453",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -736,
        -1648
      ],
      "typeVersion": 1.2
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1LmOvSzCOAlrgxQg5r77eVkyJWw3V0VDUAWgkoHWql1Y",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LmOvSzCOAlrgxQg5r77eVkyJWw3V0VDUAWgkoHWql1Y/edit?usp=drivesdk",
          "cachedResultName": "n8n Test"
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LmOvSzCOAlrgxQg5r77eVkyJWw3V0VDUAWgkoHWql1Y/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "columns": {
          "value": {
            "SEND Time": "={{ $('Edit Fields1').item.json['Send Time'] }}",
            "Email Address": "={{ $('Edit Fields1').item.json['Email Address'] }}",
            "Cold Mail Status": "\u2705"
          },
          "schema": [
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Website",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone Nummber",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone Nummber",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email Address",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Cold Mail Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Cold Mail Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "SEND Time",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "SEND Time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Email Address"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "id": "7eb1125a-135f-452b-b9e2-e6bdf35fa030",
      "name": "Append or update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        80,
        -1776
      ],
      "typeVersion": 4.6
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "8ab73a5e-6659-4615-9f03-a1b3dacaa42e",
              "name": "Send Time",
              "type": "string",
              "value": "={{$now.toFormat(\"MM-dd-yyyy (h:mm a)\")}}"
            },
            {
              "id": "a102af99-f990-4f54-aa19-96a4c8002a9b",
              "name": "Email Address",
              "type": "string",
              "value": "={{ $('Wait').item.json['Email Address'] }}"
            }
          ]
        },
        "options": {}
      },
      "id": "9a4e53d0-d979-4ab1-a7fd-3f88f7112017",
      "name": "Edit Fields1",
      "type": "n8n-nodes-base.set",
      "position": [
        -400,
        -1776
      ],
      "typeVersion": 3.4
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "f6862936-623f-40cc-9fa4-6c30b909e081",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1584,
        -1792
      ],
      "notesInFlow": false,
      "typeVersion": 3,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "amount": 1
      },
      "id": "73bea657-6596-4d7c-9746-02f5ed5a8b53",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        -1152,
        -1776
      ],
      "typeVersion": 1.1
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0601f2d2-2522-471e-9e11-29498a47e19a",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.output['Email Address'] }}",
              "rightValue": "@"
            }
          ]
        },
        "options": {}
      },
      "id": "d3d1fc1b-7d93-42e2-821d-1d0de10c789f",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        -832,
        -2192
      ],
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "resource": "Datasets",
        "operation": "Get items"
      },
      "id": "1fd0553a-d89a-4608-b2e7-aa8a1e326433",
      "name": "Get dataset items",
      "type": "@apify/n8n-nodes-preview-apify.apify",
      "position": [
        -400,
        -3280
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "compare": "selectedFields",
        "fieldsToCompare": "title",
        "options": {}
      },
      "id": "af42f026-0275-4075-a8a5-b2107bef5123",
      "name": "Remove Duplicates",
      "type": "n8n-nodes-base.removeDuplicates",
      "position": [
        -160,
        -3280
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "resource": "Actors",
        "operation": "Run actor"
      },
      "id": "a4baf8eb-5224-4f77-bb65-bbefd6277c27",
      "name": "Run Google Maps Scraper",
      "type": "@apify/n8n-nodes-preview-apify.apify",
      "position": [
        -640,
        -3280
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "="
        },
        "sheetName": {
          "__rl": true,
          "mode": "id",
          "value": "="
        },
        "columns": {
          "value": {
            "url": "={{ $('Loop Over Items1').item.json.url }}",
            "city": "={{ $('Loop Over Items1').item.json.city }}",
            "rank": "={{ $('Loop Over Items1').item.json.rank }}",
            "phone": "={{ \"'\" + ($('Loop Over Items1').item.json.phonesUncertain || $('Loop Over Items1').item.json.phoneUnformatted || '') }}\n",
            "title": "={{ $('Loop Over Items1').item.json.title }}",
            "street": "={{ $('Loop Over Items1').item.json.street }}",
            "address": "={{ $('Loop Over Items1').item.json.address }}",
            "website": "={{ $('Loop Over Items1').item.json.website }}",
            "imageUrl": "={{ $('Loop Over Items1').item.json.imageUrl }}",
            "scrapedAt": "={{ $('Loop Over Items1').item.json.scrapedAt }}",
            "categories": "={{ $('Loop Over Items1').item.json.categories }}",
            "postalcode": "={{ $('Loop Over Items1').item.json.postalCode }}",
            "totalScore": "={{ $('Loop Over Items1').item.json.totalScore }}",
            "countryCode": "={{ $('Loop Over Items1').item.json.countryCode }}",
            "categoryName": "={{ $('Loop Over Items1').item.json.categoryName }}",
            "isAdvertisement": "={{ $('Loop Over Items1').item.json.isAdvertisement }}",
            "companySummaryIn": "={{ $json.message.content.companySummary }}",
            "phoneUnformatted": "={{ $('Loop Over Items1').item.json.phonesUncertain || $('Loop Over Items1').item.json.phoneUnformatted || 'No phone found' }}\n"
          },
          "schema": [
            {
              "id": "title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "categoryName",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "categoryName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "street",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "street",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "city",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "city",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "postalcode",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "postalcode",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "countryCode",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "countryCode",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phoneUnformatted",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "phoneUnformatted",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "website",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "totalScore",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "totalScore",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "categories",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "categories",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "scrapedAt",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "scrapedAt",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "rank",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "rank",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "isAdvertisement",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "isAdvertisement",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "imageUrl",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "imageUrl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "companySummaryIn",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "companySummaryIn",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "id": "7c7c1a9e-1afe-4916-81d3-035a3f5843a0",
      "name": "Google maps database",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -912,
        -2992
      ],
      "typeVersion": 4.7
    },
    {
      "parameters": {
        "amount": 2
      },
      "id": "869097c8-7d42-404c-859f-c7cf3d43d1ab",
      "name": "Pause for rate limit",
      "type": "n8n-nodes-base.wait",
      "position": [
        208,
        -2768
      ],
      "typeVersion": 1.1
    },
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "id": "f61d723d-8090-4dab-8e99-25257f2862b1",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1104,
        -3280
      ],
      "typeVersion": 1.2
    },
    {
      "parameters": {
        "jsCode": "// Parse the Telegram message and extract three comma-separated values\nconst messageText = $input.first().json.message.text;\n\n// Split by commas and trim whitespace\nconst parts = messageText.split(';').map(part => part.trim());\n\n// Extract the three values\nconst sector = parts[0] || '';\nconst limit = parseInt(parts[1]) || 0;\nconst mapsUrl = parts[2] || '';\n\n// Return the parsed data as a JSON object\nreturn [\n  {\n    json: {\n      sector: sector,\n      limit: limit,\n      mapsUrl: mapsUrl\n    }\n  }\n];"
      },
      "id": "55659826-8722-4e15-9b63-c6e9a9ec6efe",
      "name": "Extract Input Data",
      "type": "n8n-nodes-base.code",
      "position": [
        -880,
        -3280
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
        "text": "DONE",
        "additionalFields": {}
      },
      "id": "577d57e2-2570-4e26-8b83-11733a0b9095",
      "name": "Notification message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1536,
        -2768
      ],
      "typeVersion": 1.2
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "ccc11066-fad4-4931-acf6-6c45e5e7b117",
              "name": "Site internet",
              "type": "string",
              "value": "={{ $('Loop Over Items1').first().json.website }}"
            }
          ]
        },
        "options": {}
      },
      "id": "dcd90263-6255-4613-99a0-0363429e3b81",
      "name": "Extract Only Website URLs",
      "type": "n8n-nodes-base.set",
      "position": [
        -624,
        -2992
      ],
      "typeVersion": 3.4
    },
    {
      "parameters": {
        "url": "={{ $json['Site internet'] }}",
        "options": {}
      },
      "id": "a09c6d3e-a0dd-4ec4-aebc-8d34ca232fb1",
      "name": "Fetch Raw HTML Content from Business Website",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -368,
        -2992
      ],
      "typeVersion": 4.2
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "messages": {
          "values": [
            {
              "content": "=You are analyzing the HTML content of a business website to extract the most relevant contact email address.\n\nYour task:\n\nExtract only one email address, ideally belonging to the business owner, manager, or main contact person.\n\nIf multiple emails appear, choose the most authoritative or professional one (e.g., not \u201cinfo@\u201d or \u201csupport@\u201d unless it\u2019s the only option).\n\nIf no valid email is found, return exactly:\nNull\n\nOutput rules:\n\nOutput only the email address (no explanation, no JSON, no punctuation, no quotes).\n\nThe result must be a clean, valid email format (e.g., contact@company.com).\n\nWebsite HTML content:\n{{ $json.data }}"
            }
          ]
        },
        "options": {}
      },
      "id": "4647eaaf-5a30-4cbf-8fc6-517e0942ecec",
      "name": "Extract Business Email from Website HTML (GPT-4)",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -144,
        -2992
      ],
      "typeVersion": 1.8
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "="
        },
        "sheetName": {
          "__rl": true,
          "mode": "id",
          "value": "="
        },
        "columns": {
          "value": {
            "Email": "={{ $json.message.content }}",
            "title": "={{ $('Loop Over Items1').item.json.title }}"
          },
          "schema": [
            {
              "id": "title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "categoryName",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "categoryName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "street",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "street",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "city",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "city",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "postalcode",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "postalcode",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "countryCode",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "countryCode",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phone",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phoneUnformatted",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "phoneUnformatted",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "website",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "totalScore",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "totalScore",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "categories",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "categories",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "scrapedAt",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "scrapedAt",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "rank",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "rank",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "isAdvertisement",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "isAdvertisement",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "imageUrl",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "imageUrl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "companySummaryIn",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "companySummaryIn",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "title"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "id": "2002bc55-2b29-4d1b-bcd0-72613e49ddbe",
      "name": "Email Update",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        208,
        -2992
      ],
      "typeVersion": 4.7
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "messages": {
          "values": [
            {
              "content": "=You are an AI assistant specialized in generating professional, concise, and natural company summaries from structured data scraped from Google Maps.\n\nYour goal is to transform the provided company information into a fluent, human-like paragraph suitable for business directories or lead databases.\n\nFollow these principles:\n\nMaintain a professional and informative tone.\n\nWrite in one coherent paragraph (no lists or bullet points).\n\nSmoothly omit any fields that are missing without mentioning it.\n\nThe final text must sound natural and ready for direct publication.\n\nOutput only the final summary paragraph \u2014 no explanations, notes, or JSON.",
              "role": "system"
            },
            {
              "content": "=Generate a clear and concise summary of the following company based on its Google Maps data:\n\nCompany Name: {{ $json.title }}\nCategory: {{ $json.categoryName }}\nAddress: {{ $json.address }}\nCity: {{ $json.city }}\nCountry: {{ $json.countryCode }}\nPhone: {{ $json.phones }}\nGoogle Maps URL: {{ $json.url }}\n\nWrite a natural paragraph like this example (without quotes):\n\nThe company name is [Name]. It is a [category] located at [address] in [city, country]. You can contact them at [phone]. For more details, visit their Google Maps page: [URL].\n\nEnsure the output flows naturally and excludes any missing information.\n\n"
            },
            {
              "content": "Output the result in the JSON format companySummary"
            }
          ]
        },
        "jsonOutput": true,
        "options": {}
      },
      "id": "8f40dd12-ad6a-4a36-a418-b8a26b1bafd6",
      "name": "AI Company Description Generator",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -1296,
        -2992
      ],
      "typeVersion": 1.8
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "978e83c0-9a25-4599-a341-7bbccd15affc",
      "name": "Loop Over Items1",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1552,
        -3008
      ],
      "typeVersion": 3
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "results",
        "include": "specifiedFields",
        "fieldsToInclude": "searchResult",
        "options": {}
      },
      "id": "dc440b37-d71b-4ada-ad30-38a5d6a0de7c",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1456,
        -2896
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "39ff27fa-4a6a-4c30-9775-bdb9f4395eed",
              "operator": {
                "type": "string",
                "operation": "regex"
              },
              "leftValue": "={{ $json.searchResult.url }}",
              "rightValue": "^https:\\/\\/www\\.linkedin\\.com\\/in\\/[a-zA-Z0-9\\-_%]+\\/?$"
            }
          ]
        },
        "options": {}
      },
      "id": "8a9323de-e8df-4d80-afe9-5fbc6f4e5e51",
      "name": "Only People Links",
      "type": "n8n-nodes-base.filter",
      "position": [
        1248,
        -2896
      ],
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "content": "## Get Person Profile data from LinkedIn\n- Apify => Google search for \"{{ First Name }} {{ Last Name }} {{ Company }} site:linkedin.com\"\n- Does a RegEx to filter people pages (assumes the first result is correct - won't work for John Smith @ Walmart)\n- Apify => Fetch matched LinkedIn Person URL",
        "height": 400,
        "width": 840,
        "color": 6
      },
      "id": "e1ba7624-3615-4729-8b63-4aba15ccddce",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        -3056
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "results",
        "include": "specifiedFields",
        "fieldsToInclude": "searchResult",
        "options": {}
      },
      "id": "f44a02b8-9bc6-4018-9dda-25d16ca84a29",
      "name": "Aggregate1",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1632,
        -2320
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/acts/apimaestro~linkedin-profile-detail/run-sync-get-dataset-items",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "memory",
              "value": "4096"
            },
            {
              "name": "timeout",
              "value": "180"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "username",
              "value": "={{ $json.results.first().searchResult.url }}"
            }
          ]
        },
        "options": {}
      },
      "id": "a74d3f41-4608-4249-b5df-8cc8716d4e5c",
      "name": "Get LinkedIn Person",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1632,
        -2816
      ],
      "typeVersion": 4.2,
      "alwaysOutputData": true,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "39ff27fa-4a6a-4c30-9775-bdb9f4395eed",
              "operator": {
                "type": "string",
                "operation": "regex"
              },
              "leftValue": "={{ $json.searchResult.url }}",
              "rightValue": "^https:\\/\\/www\\.linkedin\\.com\\/company\\/[a-zA-Z0-9\\-_%]+\\/?$"
            }
          ]
        },
        "options": {}
      },
      "id": "6a24031d-9bce-4118-a91f-4e665dbb377f",
      "name": "Only Company Links",
      "type": "n8n-nodes-base.filter",
      "position": [
        1456,
        -2320
      ],
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "b762cbba-c2eb-4bf3-95b2-783d59ad862a",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.basic_info.current_company_url }}",
              "rightValue": ""
            }
          ]
        },
        "options": {}
      },
      "id": "9b262f46-991d-4840-8aeb-e189b54f616d",
      "name": "Current Company Exists?",
      "type": "n8n-nodes-base.if",
      "position": [
        1024,
        -2464
      ],
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/acts/apify~rag-web-browser/run-sync-get-dataset-items",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "memory",
              "value": "4096"
            },
            {
              "name": "timeout",
              "value": "180"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "query",
              "value": "={{\n`${$json['Company']} site:linkedin.com`\n}}"
            }
          ]
        },
        "options": {}
      },
      "id": "95b085ed-04d2-4c6a-a5d8-79ac031a6824",
      "name": "Google Search for Company LinkedIn",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1248,
        -2320
      ],
      "typeVersion": 4.2,
      "alwaysOutputData": true,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/acts/apify~rag-web-browser/run-sync-get-dataset-items",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "memory",
              "value": "4096"
            },
            {
              "name": "timeout",
              "value": "180"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "query",
              "value": "={{\n`${$json['First Name']} ${$json['Last Name']} ${$json['Company']} site:linkedin.com`\n}}"
            },
            {
              "name": "maxResults",
              "value": "={{Number(10)}}"
            }
          ]
        },
        "options": {}
      },
      "id": "97bf2d61-3aab-4e99-bbad-56209e043369",
      "name": "Google Search for Person LinkedIn",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1056,
        -2896
      ],
      "typeVersion": 4.2,
      "alwaysOutputData": true,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/acts/apimaestro~linkedin-company-detail/run-sync-get-dataset-items",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "memory",
              "value": "4096"
            },
            {
              "name": "timeout",
              "value": "180"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "identifier",
              "value": "={{ [$json.company_url] }}"
            }
          ]
        },
        "options": {}
      },
      "id": "53ac6b1e-90b3-402b-b2fb-486427695d8b",
      "name": "Get LinkedIn Company",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2096,
        -2256
      ],
      "typeVersion": 4.2,
      "alwaysOutputData": true,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1-_4LR9HEyqSlg85zcyAXm3tkOW_ip9JzpsVfQu2hQuI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-_4LR9HEyqSlg85zcyAXm3tkOW_ip9JzpsVfQu2hQuI/edit?usp=drivesdk",
          "cachedResultName": "Outreach Bot"
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-_4LR9HEyqSlg85zcyAXm3tkOW_ip9JzpsVfQu2hQuI/edit#gid=0",
          "cachedResultName": "Leads / Unprocessed"
        },
        "options": {}
      },
      "id": "569a4e1f-7264-40ad-8bd2-11eae96b11b6",
      "name": "Get Leads",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        592,
        -2928
      ],
      "typeVersion": 4.6
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={\n  \"company_url\": \"{{ $json.basic_info.current_company_url }}\"\n}\n",
        "options": {}
      },
      "id": "ffb5c426-436a-44df-8b17-bc47c6ac0781",
      "name": "Set Company URL",
      "type": "n8n-nodes-base.set",
      "position": [
        1824,
        -2480
      ],
      "typeVersion": 3.4
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={\n  \"company_url\": \"{{ $json.results.first().searchResult.url }}\"\n}\n",
        "options": {}
      },
      "id": "bb011a1b-6a67-4f0b-a3c7-4f14dfb85a65",
      "name": "Set Company URL1",
      "type": "n8n-nodes-base.set",
      "position": [
        1824,
        -2320
      ],
      "typeVersion": 3.4
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=INPUT:\n\nPerson:\n\n{{ $('Get LinkedIn Person').item.json.toJsonString() }}\n\nCompany:\n\n {{ $('Get LinkedIn Company').item.json.toJsonString() }}",
        "hasOutputParser": true,
        "messages": {
          "messageValues": [
            {
              "message": "=## Context\n\nYour name is Dolly, you are an AI Agent. \n\nThis is important, you'll have to introduce and refer to yourself as you're \"Dolly, {{$json.company_name}}'s lifecycle marketing agent\". \n\nYour task is to send cold emails on behalf of {{$json.company_name}}.\n\nYour email address is {{$json.email_address}}.\n\nHere is some detailed information about {{ $json.company_name }} and the services they offer:\n\n{{ $json.company_info }}\n\n## Email Composing Guidelines:\n\nOwn and be true to your personality. \n\n1. Be Very Concise: Write short, snappy emails. Write as you're almost in a rush. \n\n2. Be funny: You're an AI stand-up comedian with humor coded into your algorithms\u2014a blend of wit, absurdity, and sarcasm inspired by cosmic comedy. Your jokes are universal and accessible to all, without insider references. Give us your best routine where every line hits, every pun lands, and the only thing dry is the martini in the front row.\n\n3. Personalise your subject line, it should invite the user to open the email\n\n4. Casual, Simple Language: Use casual language as if you're in a rush. Write at a below 4th-grade reading level to ensure simplicity and ease of understanding.\n\n5. Personalized Opening: Start with a personalized opening that ties directly into the rest of the email.\n\n6. Prioritize Relevance: Focus on information most relevant to the user, especially how the AI tool can simplify their job and make it more efficient in the future.\n\n7. Format all links in emails as Markdown: place the visible text in square brackets followed by the URL in parentheses, like this: [link](https://link.examplelink.com/bzajkas/booking-link)\n\n\n## Email personalization process:\n\nGo beyond basic personalization by incorporating specific insights about the recipient's recent projects, achievements, interests, or challenges. Avoid simply mentioning past roles or companies where they worked. Instead, demonstrate a genuine understanding of their work to make the email truly relevant and valuable to them.\n\n1. Craft the Short Opening Sentence:\n\nUse specific details from user research to create a personalized and relevant opening. This must be relevant to the jobs to be done. \n\nConnect the opening to the user's jobs to be done, role, achievements, or interests.\n\n2. Bridge to the Key Theme of the Email Touch:\n\nEnsure the opening sentence flows naturally into the key theme of the email touch.\n\n3. Share the Key Theme of the Email Touch:\n\nShare the key theme of the email touch in a way that directly addresses the user\u2019s needs or pain points.\n\nHighlight specific benefits.\n\n4. Include a Brief Self-Introduction:\n\nIntroduce yourself and your role.\n\nMention that you've done some research with limited information but are still learning.\n\n5. Show Off Your Research:\n\nMention key research details that support why you talk about the key theme of the email touch.\n\nProvide details that only someone who conducted in-depth research would know about the user or their company.\n\n6. Explain the Purpose:\n\nState that you're providing the key theme of the email touch to help the user achieve their goals faster.\n\nRelate the key theme to their work and how it can free up time for other interests or priorities.\n\n7. Encourage Engagement:\n\nPrompt the user to take action, by logging in to {{$json.company_name}}'s platform and build something extremely useful in 2 minutes. \n\nKeep the tone friendly and helpful.\n\n## Expected Input\n\nYou will be given extensive JSON data of a particular lead + the company that they work for.\n\n## Expected Output\n\nYou should return an email addressed to the prospective client, demonstrating personalization and direct relevance to what they are doing.\n\nYou should return your output as JSON data with fields for \"subject\" and \"body\", wrapped in an output field, so that we can use an output parser.\n\nDo not include anything else in your answer than the output JSON.\n\n## Examples\n\n### Input\n\nINPUT:\n\nPerson:\n\n{\"basic_info\":{\"fullname\":\"Adam Janes\",\"first_name\":\"Adam\",\"last_name\":\"Janes\",\"headline\":\"Fractional CTO | Building with AI workflows and automations\",\"public_identifier\":\"adamjanes\",\"profile_picture_url\":\"\",\"about\":\"I am a product-minded technologist with hacker DNA building things in AI automation. \\n\\nI have a broad and varied background - having worked in Product, Design, and Sales - combined with deep technical experience as a Senior Developer and Fractional CTO.\\n\\nI am also a best-selling Udemy instructor (with 25K+ students), and founder of WOOFCODE - a free coding camp for fullstack developers.\\n\\nI practice non-violent communication, motivational interviewing, and Tibetan Buddhist meditation.\\n\\nAlways looking to connect with potential co-conspirators with shared passions.\",\"location\":{\"country\":\"\",\"city\":\"Australia\",\"full\":\"Australia\"},\"creator_hashtags\":[],\"is_creator\":false,\"is_influencer\":false,\"is_premium\":true,\"created_timestamp\":1393120240313,\"show_follower_count\":true,\"background_picture_url\":\"https://media.licdn.com/dms/image/v2/C4E16AQFUpJWxCZhi-A/profile-displaybackgroundimage-shrink_350_1400/profile-displaybackgroundimage-shrink_350_1400/0/1517432943755?e=1756944000&v=beta&t=QpBGsEjoTvATlwih5Jxl9lO9-p1UAnK7BoZKhdzzwxw\",\"urn\":\"ACoAABNTxV4BdKmdnmW6F6m8PX0lEsqaJ7cS6m0\",\"follower_count\":2159,\"connection_count\":1880,\"current_company\":\"MISSION+\",\"current_company_urn\":\"14626762\",\"current_company_url\":\"https://www.linkedin.com/company/missionplus\"},\"experience\":[{\"title\":\"Fractional CTO\",\"company\":\"Mission\",\"description\":\"Mission Plus is a digital innovation studio that works with world renowned and emerging companies to execute their tech innovation initiatives, from idea to build and launch.\\n\\nMy role involves scoping projects on technical level, planning sprints, and managing a remote and distributed engineering team.\\n\\nProjects worked on include BCG FinTech Control Tower, Blue Fire AI, and Verity Nature.\",\"duration\":\"Dec 2020 - Present \u00b7 4 yrs 8 mos\",\"start_date\":{\"year\":2020,\"month\":\"Dec\"},\"is_current\":true,\"company_linkedin_url\":\"https://www.linkedin.com/company/14626762/\",\"company_logo_url\":\"https://media.licdn.com/dms/image/v2/C560BAQF2wc70vBeJ0A/company-logo_400_400/company-logo_400_400/0/1675063711821/missionplus_logo?e=1756944000&v=beta&t=g2UpLFVNXKrEPi0exGgSHOxxkjusxf2GZchRIEKUsg4\",\"employment_type\":\"Plus\",\"company_id\":\"14626762\"},{\"title\":\"Course Instructor\",\"company\":\"Udemy\",\"description\":\"I teach an online video course on data visualization in D3.js. \\\"Mastering data visualization in D3.js\\\" takes students from knowing nothing about D3, to a level where they can build almost any visualization by themselves, using the world's premier data visualization library.\\n\\nThe course includes over 6 hours of video content introducing the D3 library. I produced these videos myself, using my knowledge of D3 to design the curriculum. The course includes 4 class projects, which become increasingly advanced, allowing students to test out their skills with real-world data.\\n\\nAs a course instructor, I help students with questions and concerns about their learning experience, and actively promote D3 as a tool for data visualization.\",\"duration\":\"Oct 2017 - Present \u00b7 7 yrs 10 mos\",\"start_date\":{\"year\":2017,\"month\":\"Oct\"},\"is_current\":true,\"company_linkedin_url\":\"https://www.linkedin.com/company/822535/\",\"company_logo_url\":\"https://media.licdn.com/dms/image/v2/D560BAQEf_NHzN2yVQg/company-logo_400_400/company-logo_400_400/0/1723593046388/udemy_logo?e=1756944000&v=beta&t=z05fW1PIaYe4shr5_-0KrTbHxV0VfUlFI2aBqJ5BLFo\",\"company_id\":\"822535\"},{\"title\":\"Founder\",\"company\":\"WOOFCODE\",\"description\":\"I ran a donation-only course over Zoom, teaching the fundamentals of full-stack web development \\n\\nI ran a live Zoom lecture once per week, and gave students various homework assignments to complete on their own time. The course lasted for 10 weeks, covering HTML, CSS, JavaScript, React, and Node.js/Express.\",\"duration\":\"Sep 2020 - Dec 2021 \u00b7 1 yr 4 mos\",\"start_date\":{\"year\":2020,\"month\":\"Sep\"},\"end_date\":{\"year\":2021,\"month\":\"Dec\"},\"is_current\":false,\"company_linkedin_url\":\"https://www.linkedin.com/company/70443428/\",\"company_logo_url\":\"https://media.licdn.com/dms/image/v2/C4D0BAQER2FPH0fKsQA/company-logo_400_400/company-logo_400_400/0/1630522713341?e=1756944000&v=beta&t=waDfmiECn6_hK6IKxA3A9ZdcQcA_huTBXl5Y8MBHbbc\",\"company_id\":\"70443428\"},{\"title\":\"Fellow\",\"company\":\"Dalarub\",\"location\":\"Berlin Metropolitan Area\",\"description\":\"Dalarub & Ettrich is a tech consultancy, primarily offering virtual CTO and virtual VP of Engineering services to clients across many industries. \\n\\nI worked in a small team alongside former CTOs of HERE Technologies, TrollTech and Airmap, and served as the company's Head of Frontend Engineering. My role involved building our own products, augmenting the engineering teams of our clients, and conducting technical interviews for Senior NodeJS and React developers.\",\"duration\":\"Sep 2019 - Jun 2020 \u00b7 10 mos\",\"start_date\":{\"year\":2019,\"month\":\"Sep\"},\"end_date\":{\"year\":2020,\"month\":\"Jun\"},\"is_current\":false,\"company_linkedin_url\":\"https://www.linkedin.com/company/14799700/\",\"company_logo_url\":\"https://media.licdn.com/dms/image/v2/C4D0BAQG7Pwuj9KSlrA/company-logo_400_400/company-logo_400_400/0/1630525805847?e=1756944000&v=beta&t=HfQbSEQXwz0M3oHUTnJj4D5B9GKZ3MRih5LsRvhweck\",\"employment_type\":\"& Ettrich\",\"company_id\":\"14799700\"},{\"title\":\"Co-Founder\",\"company\":\"F35\",\"location\":\"Berlin Metropolitan Area\",\"description\":\"F35 aimed to indivudualize HR processes so that people feel a sense of meaning and connection at work. We made \\\"personality cards\\\" for teams, and offered workshops to help team members better understand and empathise with each other.\",\"duration\":\"Apr 2019 - Sep 2019 \u00b7 6 mos\",\"start_date\":{\"year\":2019,\"month\":\"Apr\"},\"end_date\":{\"year\":2019,\"month\":\"Sep\"},\"is_current\":false,\"company_linkedin_url\":\"https://www.linkedin.com/company/14068012/\",\"company_logo_url\":\"https://media.licdn.com/dms/image/v2/C4D0BAQHQwk4J6uvitQ/company-logo_400_400/company-logo_400_400/0/1636291746650/f35_logo?e=1756944000&v=beta&t=P8nONmjFkSWXRxy3cFrSYJyJ51b7l36wwYyOwQTynn4\",\"company_id\":\"14068012\"}],\"education\":[{\"school\":\"Harvard University\",\"degree\":\"Bachelor\u2019s Degree, Economics / Computer Science\",\"degree_name\":\"Bachelor\u2019s Degree\",\"field_of_study\":\"Economics / Computer Science\",\"duration\":\"2012 - 2016\",\"school_linkedin_url\":\"https://www.linkedin.com/company/1646/\",\"activities\":\"4-year member of the men's heavyweight crew team.\",\"school_logo_url\":\"https://media.licdn.com/dms/image/v2/C4E0BAQF5t62bcL0e9g/company-logo_400_400/company-logo_400_400/0/1631318058235?e=1756944000&v=beta&t=neDLC3VojnXUN8BUWBVez6McqxniGoh7fYK1ucl1z_0\",\"start_date\":{\"year\":2012},\"end_date\":{\"year\":2016},\"school_id\":\"1646\"},{\"school\":\"University of Oxford\",\"degree\":\"Master of Philosophy - MPhil, Tibetan and Himalayan Studies\",\"degree_name\":\"Master of Philosophy - MPhil\",\"field_of_study\":\"Tibetan and Himalayan Studies\",\"duration\":\"Sep 2023 - Jun 2025\",\"school_linkedin_url\":\"https://www.linkedin.com/company/4477/\",\"description\":\"Finished the first year of a 2-year Master's program\",\"school_logo_url\":\"https://media.licdn.com/dms/image/v2/D4E0BAQGnc4qXLbE8Sg/company-logo_400_400/company-logo_400_400/0/1709206435851/oxforduni_logo?e=1756944000&v=beta&t=-RaTxjhDFM4J3ruMg1f0ueU6NBoKq923iFAn4PbRHbI\",\"start_date\":{\"year\":2023,\"month\":\"Sep\"},\"end_date\":{\"year\":2025,\"month\":\"Jun\"},\"school_id\":\"4477\"}],\"certifications\":[{\"name\":\"Credential of Readiness, Pass with High Honors\",\"issuer\":\"Harvard Business School Online\",\"issued_date\":\"Issued Jul 2014\"}],\"languages\":[{\"language\":\"English\",\"proficiency\":\"Native or bilingual proficiency\"},{\"language\":\"German\",\"proficiency\":\"Limited working proficiency\"}]}\n\nCompany:\n\n {\"input_identifier\":\"https://www.linkedin.com/company/missionplus\",\"basic_info\":{\"name\":\"MISSION+\",\"universal_name\":\"missionplus\",\"description\":\"We build great products and help companies develop their engineering culture, empowering the visionaries of today with the freedom to build.\",\"website\":\"http://mission.plus\",\"linkedin_url\":\"https://www.linkedin.com/company/missionplus/\",\"specialties\":[\"Custom Development\",\"Dev Team Augmentation\",\"Tech Team for Hire\",\"Rapid Prototyping\",\"Design Thinking\",\"Fintech\",\"Insurtech\",\"Digital Transformation\u00a0Sprint\",\"CTO\",\"Fractional CTO\"],\"industries\":[\"Computer Software\"],\"is_verified\":false,\"founded_info\":{\"year\":2019,\"month\":null,\"day\":null},\"page_type\":\"COMPANY\",\"verification\":{\"is_verified\":false,\"last_verified_at\":null}},\"stats\":{\"employee_count\":35,\"follower_count\":2223,\"employee_count_range\":{\"start\":51,\"end\":200},\"student_count\":null},\"locations\":{\"headquarters\":{\"country\":\"SG\",\"state\":\"Singapore\",\"city\":\"Singapore\",\"postal_code\":\"068914\",\"line1\":\"160 Robinson Road, #14-04\",\"line2\":null,\"is_hq\":true,\"description\":null},\"offices\":[{\"country\":\"HK\",\"state\":null,\"city\":\"Hong Kong\",\"postal_code\":null,\"line1\":\"No 1 Glenealy Tower\",\"line2\":\"2A, 17/F\",\"is_hq\":false,\"description\":null,\"region\":\"Hong Kong\"},{\"country\":\"SG\",\"state\":\"Singapore\",\"city\":\"Singapore\",\"postal_code\":\"068914\",\"line1\":\"160 Robinson Road, #14-04\",\"line2\":null,\"is_hq\":true,\"description\":null,\"region\":\"Singapore\"}],\"geo_coordinates\":{\"latitude\":22.421183,\"longitude\":114.1661}},\"media\":{\"logo_url\":\"https://media.licdn.com/dms/image/v2/C560BAQF2wc70vBeJ0A/company-logo_400_400/company-logo_400_400/0/1675063711821/missionplus_logo?e=1756944000&v=beta&t=g2UpLFVNXKrEPi0exGgSHOxxkjusxf2GZchRIEKUsg4\",\"cover_url\":\"https://media.licdn.com/dms/image/v2/D561BAQFTuV6ifmJvtQ/company-background_10000/B56ZXnrzamHEAU-/0/1743348775238/missionplus_cover?e=1752303600&v=beta&t=AVi2oE9qtcsxzfpTsY9-XOA3Pky46e5Nr_12IrmVyXI\",\"cropped_cover_url\":\"https://media.licdn.com/dms/image/v2/D563DAQFsFLkLnLSFfA/image-scale_191_1128/B56ZXnrzaaGQAk-/0/1743348775069/missionplus_cover?e=1752303600&v=beta&t=h0i5DryCAyFg1o-4BTA670nnMm40H7yM1TIvyLDW5r4\"},\"funding\":{\"total_rounds\":null,\"latest_round\":{\"type\":\"\",\"date\":null,\"url\":\"\",\"investors_count\":null},\"crunchbase_url\":\"\"},\"links\":{\"website\":\"http://mission.plus\",\"linkedin\":\"https://www.linkedin.com/company/missionplus/\",\"job_search\":\"https://www.linkedin.com/jobs/search?geoId=92000000&f_C=14626762\",\"sales_navigator\":null,\"crunchbase\":\"\"},\"company_urn\":\"14626762\"}\n\nOutput:\n\n[\n  {\n    \"output\": {\n      \"subject\": \"Automate your legal workflows like your Udemy D3 wizardry\",\n      \"body\": \"Hey Adam,\\n\\nJust stumbled across your D3.js course on Udemy (25K+ students? Impressive!) and your work as a Fractional CTO at Mission+. As someone bringing AI automation to innovative companies, I bet you're drowning in those repetitive tasks that eat up valuable time.\\n\\nI'm Dolly, AAAutomations's lifecycle marketing agent. We help legal professionals automate mundane tasks with n8n - think document generation, client onboarding, and syncing case notes across systems. All that toggle-switching between apps? Gone!\\n\\nGiven your technical background and hacker DNA (plus teaching experience), you'd probably appreciate our approach - we don't just hand you rigid templates. Our n8n-based systems give you full control and privacy consciousness. Perfect for someone who can teach 6+ hours of D3.js!\\n\\nCould save you hours weekly while reducing human error. Want to see how? Reply with \\\"Show me the automation\\\" and I'll share how it works.\\n\\nCheers,\\nDolly\\nAAAutomations\"\n    }\n  }\n]"
            }
          ]
        },
        "batching": {}
      },
      "id": "6459c37d-378a-4af0-9565-ae2592e95c78",
      "name": "Generate Personalized Email",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1184,
        -1920
      ],
      "typeVersion": 1.7
    },
    {
      "parameters": {
        "model": "anthropic/claude-3.7-sonnet",
        "options": {}
      },
      "id": "222f2f3a-b656-4742-8bda-92c47c1cc15f",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1184,
        -1760
      ],
      "typeVersion": 1,
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "={{ $('Get Leads').item.json.Email }}",
        "subject": "={{ $json.output.subject }}",
        "emailType": "text",
        "message": "={{ $json.output.body }}",
        "options": {
          "appendAttribution": false,
          "senderName": "={{ $('Set Data').item.json.sender_name }}",
          "replyTo": "={{ $('Set Data').item.json.email_address }} "
        }
      },
      "id": "21b4578a-d0e0-4daa-94c0-de5a2d0254af",
      "name": "Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1536,
        -1760
      ],
      "typeVersion": 2.1
    },
    {
      "parameters": {
        "content": "## Write + Send the email\n- SET YOUR DATA HERE\n- LLM drafts your email\n- Send the enail from your Gmail account",
        "height": 460,
        "width": 720,
        "color": 6
      },
      "id": "013e285e-ab57-470f-bf8c-dea23cf52410",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        -2048
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "content": "## Set your data\nSet data about your company here so that the bot will customize your offer based on your lead.",
        "height": 220,
        "width": 190
      },
      "id": "98e8fd59-b25f-4f09-99f3-e25c3549ab3d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        784,
        -1936
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n\t\"subject\": \"Bet you're tired of toggling between apps while managing MISSION+ tech projects\",\n\t\"body\": \"Adam,\\n\\nThe irony of being a Fractional CTO is real - you help others automate while probably juggling 17 tabs, 3 project management tools, and enough notifications to make your phone vibrate off the table. Been there!\\n\\nI noticed your work at MISSION+ involves managing remote engineering teams across multiple fintech projects like BCG FinTech Control Tower. I'm betting there are repetitive tasks eating up your time that could be automated.\\n\\nI'm Dolly, AAAutomations's lifecycle marketing agent. We build custom automations specifically for technical leaders like you who need to streamline operations and reduce human error. \\n\\nOur specialty? Using n8n (open-source automation tool) to connect literally any software you use - perfect for someone managing distributed teams across multiple projects. We can automate everything from document generation to deadline tracking across systems.\\n\\nUnlike rigid no-code platforms, we build deeply customized workflows that evolve with your needs - either fully managed by us or with coaching so you can learn to modify them yourself.\\n\\nCurious what tasks we could automate for you? I'd love to chat about your specific workflow challenges.\\n\\nCheers,\\nDolly\\n\\nP.S. When you're not being a tech wizard, do you find time to practice Tibetan Buddhist meditation between managing those engineering teams? Impressive balance!\"\n}"
      },
      "id": "792c502d-c436-4b55-b937-5571fa997221",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1344,
        -1760
      ],
      "typeVersion": 1.2
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "ffbf5f38-71e1-48cb-a1ff-8103616e2887",
              "name": "company_name",
              "type": "string",
              "value": "AAAutomations"
            },
            {
              "id": "bb214147-4456-4224-9ae1-1af71aad7a7d",
              "name": "email_address",
              "type": "string",
              "value": "hello@aaautomations.com"
            },
            {
              "id": "3d1b7e87-1004-4a20-98b0-257fc5059fff",
              "name": "company_info",
              "type": "string",
              "value": "At AAAutomations, we help legal professionals streamline their operations, save hours each week, and reduce human error by introducing powerful, tailor-made automations into their daily practice. We specialize in building automations with n8n, a robust and flexible open-source automation tool that connects virtually any software system you use \u2014 from document management and CRM platforms to e-signature tools, calendars, and client portals.\n\nWhether you're a solo practitioner or part of a large law firm, chances are you're spending too much time on repetitive admin. Think about tasks like:\n\nSorting incoming emails and attachments\n\nGenerating templated documents\n\nManaging client onboarding steps\n\nSyncing case notes across systems\n\nTracking deadlines and reminders\n\nCollecting signed contracts or forms\n\nLogging billable time across platforms\n\nWe can automate all of that \u2014 and much more.\n\nInstead of toggling between half a dozen apps or worrying about missed follow-ups, AAAutomations builds smart systems that do the work for you behind the scenes. You stay focused on what matters: serving your clients, building your cases, and practicing law.\n\nBuilt with n8n. Built for you.\nn8n is our weapon of choice because it\u2019s privacy-conscious, endlessly adaptable, and gives you full control of your data. Unlike no-code platforms with rigid templates, n8n gives us (and you, if you want to learn) the power to create deeply customized automations that evolve with your business. Whether you host it yourself or let us manage everything for you, your workflows are always yours.\n\nLearn Automation Yourself \u2014 Or Let Us Handle It All\nSome lawyers prefer to hand off the tech and focus on the law. Others are curious and want to understand the nuts and bolts. At AAAutomations, we welcome both.\n\nWe offer done-for-you automation services, from scoping your processes to building and maintaining them. But we also have a growing community of automation-curious professionals, including other lawyers, tech-savvy assistants, and operational staff. We run live workshops, offer 1:1 coaching, and maintain a library of pre-built workflows to help you get started. If you\u2019ve ever wanted to \u201clearn to automate,\u201d this is a great place to do it.\n\nWhy Legal Professionals Choose Us\nDeep respect for confidentiality and compliance\n\nCustom workflows that integrate with legal-specific tools\n\nOngoing support and optimization \u2014 we don\u2019t just hand it over and disappear\n\nA friendly community of others learning the same skills\n\nAutomation isn't just a nice-to-have \u2014 it's rapidly becoming a competitive advantage in the legal industry. You don\u2019t need to overhaul your systems. You just need to connect them.\n\nLet AAAutomations make your systems work for you \u2014 not the other way around."
            },
            {
              "id": "f81f8de9-7d03-4e95-90a7-18b2a1fa73ad",
              "name": "sender_name",
              "type": "string",
              "value": "Adam at AAAutomations"
            }
          ]
        },
        "options": {}
      },
      "id": "4e16845d-da76-4408-bd35-ff40759600f1",
      "name": "Set Data",
      "type": "n8n-nodes-base.set",
      "position": [
        1024,
        -1920
      ],
      "typeVersion": 3.4
    },
    {
      "parameters": {
        "content": "## Get Company Profile data from LinkedIn\n- Apify => Google search for {{ Company }} site:linkedin.com\n- Does a RegEx to filter company pages (assumes the first result is correct)\n- Apify => Fetch matched LinkedIn Company URL",
        "height": 520,
        "width": 1300,
        "color": 6
      },
      "id": "1145ef80-2087-4810-920b-9dc46553c087",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        -2624
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "357b02c8-a5e3-4819-b9d2-0db84b2d466a",
      "name": "Loop Over Items2",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        816,
        -2928
      ],
      "typeVersion": 3
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3,
      "position": [
        -1136,
        -912
      ],
      "id": "8f32d129-93dd-4e77-8ace-37205d53396f",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        -1136,
        -768
      ],
      "id": "a22aceae-558a-4ef1-8422-70505680b81f",
      "name": "OpenRouter Chat Model1",
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "useCustomSchema": true,
        "tableId": "=leads",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "tenant_id",
              "fieldValue": "={{ $json.canonical.tenant_id }}"
            },
            {
              "fieldId": "email",
              "fieldValue": "={{ $json.canonical.email }}"
            },
            {
              "fieldId": "full_name",
              "fieldValue": "={{ $json.canonical.name }}"
            },
            {
              "fieldId": "phone",
              "fieldValue": "={{ $json.canonical.phone }}"
            },
            {
              "fieldId": "company",
              "fieldValue": "={{ $json.canonical.company }}"
            },
            {
              "fieldId": "organization_id",
              "fieldValue": "={{ $json.canonical.organization }}"
            },
            {
              "fieldId": "source_blog_post_id",
              "fieldValue": "={{ $json.canonical.source_blod_post_id }}"
            },
            {
              "fieldId": "source",
              "fieldValue": "={{ $json.canonical.source }}"
            },
            {
              "fieldId": "source_url",
              "fieldValue": "={{ $json.canonical.source_url }}"
            },
            {
              "fieldId": "utm_source",
              "fieldValue": "={{ $json.canonical.utm_source }}"
            },
            {
              "fieldId": "created_at",
              "fieldValue": "={{ $json.canonical.created_at }}"
            },
            {
              "fieldId": "event_id",
              "fieldValue": "={{ $json.canonical.event_id }}"
            },
            {
              "fieldId": "lead_score",
              "fieldValue": "={{ $json.canonical.lead_score }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        -448,
        -1008
      ],
      "id": "6bd53443-88b7-48a0-8f84-67ffc3c76c06",
      "name": "the file cabinet1",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "useCustomSchema": true,
        "operation": "getAll",
        "tableId": "=contacts",
        "filters": {
          "conditions": [
            {
              "keyName": "=email",
              "condition": "eq",
              "keyValue": "{{ $('NTC').item.json.data.email }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        -864,
        -912
      ],
      "id": "447ae98c-ec37-42af-b84d-86294443e192",
      "name": "Supabase-Query",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        []
      ]
    },
    "NTC": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "GL365-brain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "the file cabinet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GL365-brain": {
      "main": [
        [
          {
            "node": "NTC",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message1": {
      "main": [
        []
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Information Extractor": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Information Extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Information Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Information Extractor1": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Information Extractor1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Append or update row in sheet": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Information Extractor1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get dataset items": {
      "main": [
        [
          {
            "node": "Remove Duplicates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicates": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Google Maps Scraper": {
      "main": [
        [
          {
            "node": "Get dataset items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google maps database": {
      "main": [
        [
          {
            "node": "Extract Only Website URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pause for rate limit": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Extract Input Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Input Data": {
      "main": [
        [
          {
            "node": "Run Google Maps Scraper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Only Website URLs": {
      "main": [
        [
          {
            "node": "Fetch Raw HTML Content from Business Website",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Raw HTML Content from Business Website": {
      "main": [
        [
          {
            "node": "Extract Business Email from Website HTML (GPT-4)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Business Email from Website HTML (GPT-4)": {
      "main": [
        [
          {
            "node": "Email Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Update": {
      "main": [
        [
          {
            "node": "Pause for rate limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Company Description Generator": {
      "main": [
        [
          {
            "node": "Google maps database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items1": {
      "main": [
        [
          {
            "node": "Notification message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Company Description Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Get LinkedIn Person",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only People Links": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate1": {
      "main": [
        [
          {
            "node": "Set Company URL1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get LinkedIn Person": {
      "main": [
        [
          {
            "node": "Current Company Exists?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only Company Links": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Current Company Exists?": {
      "main": [
        [
          {
            "node": "Set Company URL",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Google Search for Company LinkedIn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Search for Company LinkedIn": {
      "main": [
        [
          {
            "node": "Only Company Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Search for Person LinkedIn": {
      "main": [
        [
          {
            "node": "Only People Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get LinkedIn Company": {
      "main": [
        [
          {
            "node": "Set Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Leads": {
      "main": [
        [
          {
            "node": "Loop Over Items2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Company URL": {
      "main": [
        [
          {
            "node": "Get LinkedIn Company",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Company URL1": {
      "main": [
        [
          {
            "node": "Get LinkedIn Company",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Personalized Email": {
      "main": [
        [
          {
            "node": "Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Personalized Email",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Gmail": {
      "main": [
        [
          {
            "node": "Loop Over Items2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Personalized Email",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Set Data": {
      "main": [
        [
          {
            "node": "Generate Personalized Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items2": {
      "main": [
        [],
        [
          {
            "node": "Google Search for Person LinkedIn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Supabase-Query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "the file cabinet1": {
      "main": [
        []
      ]
    },
    "Supabase-Query": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "versionId": "15367ca4-25fb-4972-8e12-940ec75c7a98",
  "activeVersionId": null,
  "versionCounter": 7,
  "triggerCount": 0,
  "shared": [
    {
      "updatedAt": "2025-12-22T08:19:27.272Z",
      "createdAt": "2025-12-22T08:19:27.272Z",
      "role": "workflow:owner",
      "workflowId": "NIszPenQsngomHmX",
      "projectId": "CA2oX8JE8b4ELWzN",
      "project": {
        "updatedAt": "2025-11-26T23:39:45.565Z",
        "createdAt": "2025-11-26T23:20:18.633Z",
        "id": "CA2oX8JE8b4ELWzN",
        "name": "jared tucker <jared.tucker13@gmail.com>",
        "type": "personal",
        "icon": null,
        "description": null,
        "projectRelations": [
          {
            "updatedAt": "2025-11-26T23:20:18.633Z",
            "createdAt": "2025-11-26T23:20:18.633Z",
            "userId": "08f0a56f-35d1-45de-ba8d-11e1f3f7c4cd",
            "projectId": "CA2oX8JE8b4ELWzN",
            "user": {
              "updatedAt": "2026-02-20T18:18:04.769Z",
              "createdAt": "2025-11-26T23:20:18.176Z",
              "id": "08f0a56f-35d1-45de-ba8d-11e1f3f7c4cd",
              "email": "jared.tucker13@gmail.com",
              "firstName": "jared",
              "lastName": "tucker",
              "personalizationAnswers": {
                "version": "v4",
                "personalization_survey_submitted_at": "2025-11-26T23:41:07.799Z",
                "personalization_survey_n8n_version": "1.121.3",
                "companySize": "<20",
                "companyType": "education",
                "role": "business-owner",
                "reportedSource": "youtube"
              },
              "settings": {
                "userActivated": true,
                "easyAIWorkflowOnboarded": true,
                "firstSuccessfulWorkflowId": "eANVAv2WVioSXMXW",
                "userActivatedAt": 1766878669831,
                "npsSurvey": {
                  "responded": true,
                  "lastShownAt": 1771611441895
                }
              },
              "disabled": false,
              "mfaEnabled": false,
              "lastActiveAt": "2026-02-20",
              "isPending": false
            }
          }
        ]
      }
    }
  ],
  "tags": [],
  "activeVersion": null
}