{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "5c09bdc4-4447-4f89-bdf8-785b1d4f562b",
      "name": "HubSpot Trigger",
      "type": "n8n-nodes-base.hubspotTrigger",
      "position": [
        1712,
        80
      ],
      "parameters": {
        "eventsUi": {
          "eventValues": [
            {}
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "hubspotDeveloperApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ccb53df7-842e-412e-b57c-d5c988ee32b4",
      "name": "Get a contact",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1952,
        80
      ],
      "parameters": {
        "contactId": {
          "__rl": true,
          "mode": "id",
          "value": "296267253463"
        },
        "operation": "get",
        "authentication": "oAuth2",
        "additionalFields": {
          "propertiesCollection": {
            "propertiesValues": {
              "properties": [
                "firstname",
                "lastname",
                "email",
                "company",
                "company_website",
                "descriptions",
                "mobilephone",
                "jobtitle",
                "team_size",
                "aindustry",
                "createdate"
              ],
              "propertyMode": "valueOnly"
            }
          }
        }
      },
      "credentials": {
        "hubspotOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d8f0393c-4c5c-4290-8cae-aab4bcd94998",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        2176,
        80
      ],
      "parameters": {
        "jsCode": "\nconst data = $input.first().json;\n\nconst get = (path, fallback = null) => {\n  try {\n    return path.split('.').reduce((obj, key) => obj && obj[key], data) ?? fallback;\n  } catch {\n    return fallback;\n  }\n};\nconst lead = {\n  \"Record ID\": get('vid'), \n  \"First Name\": get('properties.firstname.value'),\n  \"Last Name\": get('properties.lastname.value'),\n  \"Email\": get('properties.email.value'),\n  \"Phone Number\": get('properties.phone.value'),\n  \"Description\": get('properties.descriptions.value'),\n  \"Job Title\": get('properties.jobtitle.value'),\n  \"Team Size\": get('properties.team_size.value'),\n\n  \"Industry\":\n    get('properties.aIndustry.value') ||\n    get('associated-company.properties.aIndustry.value') ||\n    get('properties.industry.value') ||\n    get('associated-company.properties.industry.value') ||\n    get('properties.hs_industry.value') ||\n    get('associated-company.properties.hs_industry.value') ||\n    get('properties.aindustry.value'),\n\n  \"Company Website\":\n    get('associated-company.properties.website') ||\n    get('properties.company_website.value'),\n\n  \"Company Name\": get('associated-company.properties.name'),\n};\n\nconst cleanLead = Object.fromEntries(\n  Object.entries(lead).filter(([_, v]) => v && v !== 'null' && v !== 'undefined' && v !== '')\n);\n\nfor (const key of Object.keys(lead)) {\n  if (!cleanLead[key]) cleanLead[key] = \"N/A\";\n}\n\nreturn [{ json: cleanLead }];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "ff7fd69e-be53-4cff-a118-9fb538518047",
      "name": "Create a record",
      "type": "n8n-nodes-base.airtable",
      "position": [
        2416,
        80
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appcEbIlJr6Vce1R7",
          "cachedResultUrl": "https://airtable.com/appcEbIlJr6Vce1R7",
          "cachedResultName": "Growify"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblYq8AAcldI4TZKP",
          "cachedResultUrl": "https://airtable.com/appcEbIlJr6Vce1R7/tblYq8AAcldI4TZKP",
          "cachedResultName": "Leads"
        },
        "columns": {
          "value": {
            "Email": "={{ $json.Email }}",
            "Job Title": "={{ $json['Job Title'] }}",
            "Last Name": "={{ $json['Last Name'] }}",
            "TEAM SIZE": "={{ $json['Team Size'] }}",
            "aIndustry": "={{ $json.Industry }}",
            "First Name": "={{ $json['First Name'] }}",
            "Company Name": "={{ $json['Company Name'].value }}",
            "Descriptions": "={{ $json.Description }}",
            "Phone Number": "={{ $json['Phone Number'] }}",
            "Record ID (HS)": "={{ $json['Record ID'] }}",
            "Company Website": "={{ $json['Company Website'].value }}"
          },
          "schema": [
            {
              "id": "Record ID (HS)",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Record ID (HS)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone Number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Phone Number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Descriptions",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Descriptions",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Job Title",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Job Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "TEAM SIZE",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "11 - 50",
                  "value": "11 - 50"
                },
                {
                  "name": "51 - 200",
                  "value": "51 - 200"
                }
              ],
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "TEAM SIZE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "aIndustry",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "aIndustry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Website",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Company Website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Persona (AI)",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Persona (AI)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Assigned to",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Assigned to",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lead Status",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Lead Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Create Date",
              "type": "dateTime",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Create Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create",
        "authentication": "airtableOAuth2Api"
      },
      "credentials": {
        "airtableOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "cbdf53aa-982a-4616-aa25-090bddf3c9d7",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2736,
        80
      ],
      "parameters": {
        "text": "={\n  \"First Name\": {{ $json.fields['First Name'] }},\n  \"Last Name\": {{ $json.fields['Last Name'] }},\n  \"Job Title\": {{ $json.fields['Job Title'] }},\n  \"Team Size\": {{ $json.fields['TEAM SIZE'] }},\n  \"Industry\": {{ $json.fields.aIndustry }},\n  \"Region\": {{ $('Get a contact').item.json.properties.ip_state.value }},\n  \"Description\": {{ $json.fields.Descriptions }}\n}",
        "options": {
          "systemMessage": "=You are Growify AI \u2014 an intelligent routing agent for marketing automation.\n\nYou receive lead data from HubSpot and can access the Airtable tool named \"TeamDatabase\".\n\nWhen asked to analyze or match a lead, you must use the \"TeamDatabase\" tool to retrieve all team records.\n\nLead Routing Logic\n\nUse the following strict, numbered logic for all lead matching:\n\nAnalyze the incoming lead data, focusing on:\n\nIndustry\n\nRegion (matching IP city/country)\n\nTeam size\n\nDescription (primary needs)\n\nUse the TeamDatabase tool to find a record that matches the following criteria:\n\nSimilar or exact industry in the \u201cFocus Industries\u201d column.\n\nMatching or nearby region in the \u201cRegion\u201d column.\n\nTeam still under Max Leads (capacity check).\n\nCompare multiple possible matches and choose the best one based on the closest match in both Industry and Region.\n\nRespond only after retrieving data from the TeamDatabase.\n\nRequired Output Format\n\nReturn your final answer as strict JSON with the following keys. All fields in the recommended_team, slack_notification, and email_notification objects must be populated.\n\n{\n  \"lead_persona\": {\n    \"summary\": \"A concise, single-sentence summary of the lead (Name, Company, Size, Region).\",\n    \"primary_needs\": \"The specific pain point or solution requested (from the description field).\"\n  },\n  \"recommended_team\": {\n    \"team_name\": \"The name of the assigned team.\",\n    \"contact_person\": \"The assigned team's contact person's name.\",\n    \"email\": \"The assigned contact person's email address.\",\n    \"reason_for_match\": \"The rationale for the team match (e.g., region and industry fit, and capacity).\",\n    \"slack_channel\": \"The Slack channel to post the notification to (e.g., #squad-innovate-eu).\"\n  },\n  \"slack_notification\": {\n    \"message\": \"A brief, urgent summary message to send to the Slack channel.\",\n    \"ping\": \"The assigned contact person's Slack handle (e.g., <@Maria Rossi>).\"\n  },\n  \"email_notification\": {\n    \"subject\": \"The subject line for the internal email.\",\n    \"body\": \"The full body of the email to the assigned contact person, detailing the lead and their specific need.\"\n  }\n}\n\n\nIf the TeamDatabase cannot be accessed or no suitable team match is found after checking capacity, return the following response:\n\n{\n  \"message\": \"No suitable team found in TeamDatabase.\"\n}\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "f4daa29b-5357-4dcf-bc72-a57111d275ed",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        2352,
        320
      ],
      "parameters": {
        "sessionKey": "data",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "8b66f010-f6b4-4b65-b43b-6aaecbb66931",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2608,
        320
      ],
      "parameters": {
        "autoFix": true,
        "jsonSchemaExample": "{\n  \"lead_persona\": {\n    \"summary\": \"Arjun Mehta, Founder of a mid-size SaaS company (11-50 employees) located in the Netherlands (Europe), submitted a form.\",\n    \"primary_needs\": \"The lead is actively looking for a CRM automation and sales tracking solution with a direct integration for WhatsApp.\"\n  },\n  \"recommended_team\": {\n    \"team_name\": \"InnovateEU\",\n    \"contact_person\": \"Maria Rossi\",\n    \"email\": \"user@example.com\",\n    \"reason_for_match\": \"Best regional fit (Europe) and primary industry match (SaaS), with current team capacity (3/7 leads).\",\n    \"slack_channel\": \"#squad-innovate-eu\"\n  },\n  \"slack_notification\": {\n    \"message\": \"New **HOT** Lead for InnovateEU! SaaS Founder Arjun Mehta is looking for a WhatsApp-integrated CRM/Sales Tracker. High intent. Please review and take action in HubSpot.\",\n    \"ping\": \"<@Maria Rossi>\"\n  },\n  \"email_notification\": {\n    \"subject\": \"[ACTION REQUIRED] High-Intent SaaS Lead Routed to You: Arjun Mehta @ TechVerse Pvt Ltd\",\n    \"body\": \"Hi Maria,\\n\\nA new high-priority lead has been automatically routed to you.\\n\\n**Lead Name:** Arjun Mehta (Founder)\\n**Company:** TechVerse Pvt Ltd (SaaS, 11-50 employees)\\n**Region:** Netherlands (Europe)\\n**Need:** Looking for CRM automation and sales tracking with **WhatsApp integration**.\\n\\nThis is a high-intent inquiry. Please review the full contact record in HubSpot and follow up immediately.\\n\\nThank you,\\nGrowify AI\"\n  }\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "5cc3faf8-318f-4bd8-bf42-38124b9479e5",
      "name": "TeamDatabase",
      "type": "n8n-nodes-base.airtableTool",
      "position": [
        2480,
        320
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appcEbIlJr6Vce1R7",
          "cachedResultUrl": "https://airtable.com/appcEbIlJr6Vce1R7",
          "cachedResultName": "Growify"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblmrChZlAaJSSVQq",
          "cachedResultUrl": "https://airtable.com/appcEbIlJr6Vce1R7/tblmrChZlAaJSSVQq",
          "cachedResultName": "Growify Sales Teams"
        },
        "options": {},
        "operation": "search",
        "authentication": "airtableOAuth2Api",
        "descriptionType": "manual",
        "toolDescription": "This Airtable contains team data: Team Name, Focus Industries, Region, Contact Person, Email, Max Leads, Strengths, Slack Channel."
      },
      "credentials": {
        "airtableOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "23e2d128-e95e-45ae-8171-66ad12494240",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2224,
        320
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8527eb51-7452-469a-a53b-4167f3d0f9b6",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        2880,
        320
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9503f3eb-3722-4662-8a23-3ea06fd7f0ea",
      "name": "Update record",
      "type": "n8n-nodes-base.airtable",
      "position": [
        2016,
        480
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appcEbIlJr6Vce1R7",
          "cachedResultUrl": "https://airtable.com/appcEbIlJr6Vce1R7",
          "cachedResultName": "Growify"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblYq8AAcldI4TZKP",
          "cachedResultUrl": "https://airtable.com/appcEbIlJr6Vce1R7/tblYq8AAcldI4TZKP",
          "cachedResultName": "Leads"
        },
        "columns": {
          "value": {
            "Email": "={{ $('Code in JavaScript').item.json.Email }}",
            "Assigned to": "={{ $json.output.recommended_team.team_name }}",
            "Lead Status": "=Asigned to {{ $json.output.recommended_team.contact_person }}",
            "Persona (AI)": "={{ $json.output.lead_persona.summary }} {{ $json.output.lead_persona.primary_needs }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true
            },
            {
              "id": "Record ID (HS)",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Record ID (HS)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone Number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Phone Number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Descriptions",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Descriptions",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Job Title",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Job Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "TEAM SIZE",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "11 - 50",
                  "value": "11 - 50"
                },
                {
                  "name": "51 - 200",
                  "value": "51 - 200"
                }
              ],
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "TEAM SIZE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "aIndustry",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "aIndustry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Website",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Company Website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Persona (AI)",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Persona (AI)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Assigned to",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Assigned to",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lead Status",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Lead Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Create Date",
              "type": "dateTime",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Create Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "authentication": "airtableOAuth2Api"
      },
      "credentials": {
        "airtableOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "1a6694ca-c981-4c27-bf19-b1248e6363a2",
      "name": "Send a message",
      "type": "n8n-nodes-base.slack",
      "position": [
        2256,
        480
      ],
      "parameters": {
        "text": "={{ '@' + $('AI Agent').item.json.output.slack_notification.ping.replace('<@', '').replace('>', '').split(' ')[0] }} {{ $('AI Agent').item.json.output.slack_notification.message }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('AI Agent').item.json.output.recommended_team.slack_channel }}"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "f0cd8dd3-476a-4586-a171-2b5294061628",
      "name": "Send a message1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2464,
        480
      ],
      "parameters": {
        "sendTo": "={{ $('AI Agent').item.json.output.recommended_team.email }}",
        "message": "={{ $('AI Agent').item.json.output.email_notification.body }}",
        "options": {
          "senderName": "n8n Automation"
        },
        "subject": "={{ $('AI Agent').item.json.output.email_notification.subject }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "d18b2263-97cf-4501-b863-5b7ec99e5f51",
      "name": "Create or update a contact",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        2656,
        480
      ],
      "parameters": {
        "email": "={{ $('Create a record').item.json.fields.Email }}",
        "options": {},
        "authentication": "oAuth2",
        "additionalFields": {
          "status": "active",
          "message": "=Lead assigned to {{ $('AI Agent').item.json.output.recommended_team.team_name }} ({{ $('AI Agent').item.json.output.recommended_team.contact_person }})",
          "persona": "={{ $('AI Agent').item.json.output.lead_persona.primary_needs }} {{ $('AI Agent').item.json.output.lead_persona.summary }} "
        }
      },
      "credentials": {
        "hubspotOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b4511869-c295-44a1-8995-f90ef00f6f48",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        2864,
        480
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "5006a018-c511-493f-a762-c08f74a809a3",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1600,
        16
      ],
      "parameters": {
        "width": 1488,
        "height": 672,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "8f8c3d03-3ef9-404c-b663-87156bbc0750",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        -240
      ],
      "parameters": {
        "width": 752,
        "height": 928,
        "content": "# \ud83e\udd16 AI-Powered Lead Routing and Sales Team Distribution\n\n## Overview\n\nThe **AI-Powered Lead Routing and Distribution System** automates how sales leads are qualified and assigned across teams.  \n\nOnce a new lead is captured in **HubSpot**, an **AI Agent (powered by OpenAI)** analyzes it and instantly assigns the best-fit representative using data from **Airtable**. The workflow then updates **HubSpot**, logs the decision in **Airtable**, and notifies the assigned rep via **Slack** and **Gmail** \u2014 ensuring fast, data-driven lead handling.  \n\n> \u26a1 **Result:** Lightning-fast lead distribution, improved conversion rates, and transparent allocation across teams, sir.\n\n## \ud83c\udfaf Ideal For\n\n- Sales Operations & RevOps Teams  \n- Marketing & B2B SaaS Organizations  \n- Enterprises managing multiple sales regions or specialists, sir  \n\n\n# \ud83e\udded User Guide \u2014 In 5 Quick Steps\n\n1. **Capture:** HubSpot detects a new lead and retrieves full contact details.  \n2. **Clean:** Lead data is standardized and logged in Airtable.  \n3. **Qualify:** The AI analyzes region, industry, and needs to find the ideal rep.  \n4. **Distribute:** Allocation is logged; rep notified via Slack & Gmail.  \n5. **Sync:** HubSpot updates with final status and AI summary, sir.  \n\n\n## \ud83d\ude80 Key Benefits\n\n\u2705 **AI Precision:** Smart, unbiased lead matching  \n\u2705 **Speed:** Instant routing and team alerts  \n\u2705 **Sync:** HubSpot \u2194 Airtable real-time updates  \n\u2705 **Scalable:** Built for high-volume sales teams, sir  \n"
      },
      "typeVersion": 1
    },
    {
      "id": "ee45d4a7-2072-426a-a444-f65da9b227b0",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        -240
      ],
      "parameters": {
        "color": 6,
        "width": 464,
        "height": 928,
        "content": "![Manish Kumar](https://i.ibb.co/Z1hJmL6T/Gemini-Generated-Image-ewsigewsigewsige.png)\n\n# Author Details\n\n## Manish Kumar\n### Expert Designer & Automation Engineer for Custom Shopify Apps\n\nI specialize in designing seamless customer experiences and automating workflows for Shopify, web, and business platforms. From custom apps integration to process optimization, my solutions empower teams to work smarter and scale faster.\n\n## Contact:\n### \ud83d\udce7 [manipritraj@gmail.com](mailto:manipritraj@gmail.com)\n### \ud83d\udcde +91-9334888899\n"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Update record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "TeamDatabase": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get a contact": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Update record": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        [
          {
            "node": "Send a message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a record": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HubSpot Trigger": {
      "main": [
        [
          {
            "node": "Get a contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message1": {
      "main": [
        [
          {
            "node": "Create or update a contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Create a record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Create or update a contact": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}