{
  "id": "REMOVED_FOR_PRIVACY",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "11 - B2B Intel Uplink",
  "tags": [],
  "nodes": [
    {
      "id": "6cb9736d-0484-41e5-bb15-1dad740b7ca8",
      "name": "\ud83d\udce5 Sheet Trigger - New Company",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -1780,
        80
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Company's"
        }
      },
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ffb9fb95-1acf-496f-89d0-f8ee4a8e5281",
      "name": "\ud83e\uddf9 Filter: Non-Empty Company Name'",
      "type": "n8n-nodes-base.if",
      "position": [
        -1560,
        80
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json['Company Name'] }}",
              "operation": "isNotEmpty"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8a554f66-63ed-432a-a7cf-1eced7e69cfd",
      "name": "\ud83e\udd16 OpenAI Enrichment (GPT-4o-mini)",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -1340,
        80
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {
          "maxTokens": 500,
          "temperature": 0.3
        },
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a business intelligence assistant that provides accurate company information. Return your response as a valid JSON object with the following structure:\n{\n  \"Company Name\": \"string\"\n  \"industry\": \"string\",\n  \"description\": \"string (max 200 characters)\",\n  \"company_size\": \"string (Small/Medium/Large/Enterprise)\",\n  \"headquarters\": \"string (City, Country)\",\n  \"website\": \"string (if known, otherwise null)\",\n  \"founded_year\": \"number (if known, otherwise null)\",\n  \"business_type\": \"string (B2B/B2C/B2B2C)\"\n}\n\nProvide accurate information based on your knowledge. If you're unsure about specific details, use null for that field."
            },
            {
              "content": "=Provide detailed information about the company: {{ $json['Company Name'] }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "66bd0732-d785-4360-9037-1c111da4b7cb",
      "name": "\ud83e\uddfe Parse Enriched Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -964,
        80
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{ $json.message.content }}"
      },
      "typeVersion": 3
    },
    {
      "id": "985924aa-dd77-4d2c-9648-26d6b842942d",
      "name": "\ud83d\udd0d HubSpot: Find Company by Domain",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        -744,
        80
      ],
      "parameters": {
        "domain": "={{ $json[\"Company Name\"] }}",
        "options": {},
        "resource": "company",
        "operation": "searchByDomain",
        "authentication": "appToken"
      },
      "credentials": {
        "hubspotAppToken": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "bb322fb5-b449-4106-8f39-36c66b742a79",
      "name": "\u2696\ufe0f Check: Company Exists in HubSpot?",
      "type": "n8n-nodes-base.if",
      "position": [
        -524,
        80
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e394276a-8753-46d6-bb4e-e993263ef805",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "bed544fe-3b79-4cd7-9fc9-d938195f73fd",
      "name": "\ud83c\udfe2 Create Company in HubSpot",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        -304,
        155
      ],
      "parameters": {
        "name": "={{ $('\ud83e\uddfe Parse Enriched Data').item.json[\"Company Name\"] }}",
        "resource": "company",
        "authentication": "appToken",
        "additionalFields": {
          "websiteUrl": "={{ $('\ud83e\uddfe Parse Enriched Data').item.json.website }}",
          "description": "={{ $('\ud83e\uddfe Parse Enriched Data').item.json.description }}",
          "yearFounded": "={{ $('\ud83e\uddfe Parse Enriched Data').item.json.founded_year }}",
          "countryRegion": "={{ $('\ud83e\uddfe Parse Enriched Data').item.json.headquarters }}"
        }
      },
      "credentials": {
        "hubspotAppToken": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "bf7b2709-51e7-47bb-99f3-9577cd017484",
      "name": "\ud83e\uddf0 Prepare Sheet Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -84,
        80
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "471e239f-294c-42c7-8077-8631efe0212e",
      "name": "\ud83d\udcca Update Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        136,
        80
      ],
      "parameters": {
        "columns": {
          "value": {
            "Website": "={{ $('\ud83e\uddfe Parse Enriched Data').item.json.website }}",
            "Industry": "={{ $('\ud83e\uddfe Parse Enriched Data').item.json.industry }}",
            "Description": "={{ $('\ud83e\uddfe Parse Enriched Data').item.json.description }}",
            "Headquaters": "={{ $('\ud83e\uddfe Parse Enriched Data').item.json.headquarters }}",
            "Company Name": "={{ $('\ud83e\uddfe Parse Enriched Data').item.json[\"Company Name\"] }}",
            "Company Size": "={{ $('\ud83e\uddfe Parse Enriched Data').item.json.company_size }}",
            "Founded Year": "={{ $('\ud83e\uddfe Parse Enriched Data').item.json.founded_year }}",
            "Buisness Type": "={{ $('\ud83e\uddfe Parse Enriched Data').item.json.business_type }}"
          },
          "schema": [
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Industry",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Industry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Description",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Size",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company Size",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Headquaters",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Headquaters",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Website",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Founded Year",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Founded Year",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Buisness Type",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Buisness Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Company Name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Company's"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "cc020973-ba65-4d33-8418-0d11e46b5f0a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1840,
        -140
      ],
      "parameters": {
        "color": 5,
        "width": 440,
        "height": 560,
        "content": "## Lead Intake Filter\n\n*This block triggers the workflow from a newly added row in Google Sheets, representing a fresh lead. It then filters out contacts that are incomplete, duplicated, or already enriched, ensuring that only valid and unique leads proceed for enrichment.*"
      },
      "typeVersion": 1
    },
    {
      "id": "f7704369-4be3-4505-9dc4-e92115804665",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1380,
        -140
      ],
      "parameters": {
        "color": 3,
        "width": 580,
        "height": 560,
        "content": "## Company Intelligence via GPT-4o-mini\n\n*This module uses OpenAI to extract rich company insights such as industry, company size, year founded, and a brief summary. The response is parsed into structured JSON for consistent downstream use.*"
      },
      "typeVersion": 1
    },
    {
      "id": "08b3b367-79cc-4d7d-bc1d-65323fa72cb7",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -780,
        -140
      ],
      "parameters": {
        "width": 620,
        "height": 560,
        "content": "## CRM Sync: HubSpot Company Management\n\n*Ensures a clean and accurate CRM. First, it checks if the company exists in HubSpot using its domain. If not found, it auto-creates a new entry using enriched data to prevent duplicates and improve outreach workflows.*"
      },
      "typeVersion": 1
    },
    {
      "id": "74983ef9-6c90-42f8-95be-b53343030af7",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -140,
        -140
      ],
      "parameters": {
        "color": 4,
        "width": 460,
        "height": 560,
        "content": "## Google Sheets Recordkeeping\n\n*Captures all enriched and CRM-synced companies in a Google Sheet for visibility and operational traceability. Ensures each entry has a consistent structure for review and auditing.*"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "REMOVED_FOR_PRIVACY",
  "connections": {
    "\ud83e\uddf0 Prepare Sheet Data": {
      "main": [
        [
          {
            "node": "\ud83d\udcca Update Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udcca Update Google Sheet": {
      "main": [
        []
      ]
    },
    "\ud83e\uddfe Parse Enriched Data": {
      "main": [
        [
          {
            "node": "\ud83d\udd0d HubSpot: Find Company by Domain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83c\udfe2 Create Company in HubSpot": {
      "main": [
        [
          {
            "node": "\ud83e\uddf0 Prepare Sheet Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udce5 Sheet Trigger - New Company": {
      "main": [
        [
          {
            "node": "\ud83e\uddf9 Filter: Non-Empty Company Name'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udd0d HubSpot: Find Company by Domain": {
      "main": [
        [
          {
            "node": "\u2696\ufe0f Check: Company Exists in HubSpot?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83e\udd16 OpenAI Enrichment (GPT-4o-mini)": {
      "main": [
        [
          {
            "node": "\ud83e\uddfe Parse Enriched Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83e\uddf9 Filter: Non-Empty Company Name'": {
      "main": [
        [
          {
            "node": "\ud83e\udd16 OpenAI Enrichment (GPT-4o-mini)",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "\u2696\ufe0f Check: Company Exists in HubSpot?": {
      "main": [
        [
          {
            "node": "\ud83e\uddf0 Prepare Sheet Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\ud83c\udfe2 Create Company in HubSpot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}