{
  "name": "Company Research Agent",
  "nodes": [
    {
      "parameters": {
        "operation": "getAll",
        "documentId": { "value": "YOUR_GOOGLE_SHEET_ID" },
        "sheetName": "Companies",
        "filters": { "conditions": [{ "value1": "Enriched", "condition": "isEmpty" }] }
      },
      "id": "g1h2i3j4-0001-0001-0001-000000000001",
      "name": "Get Company List",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4,
      "position": [240, 300],
      "credentials": { "googleSheetsOAuth2Api": { "id": "YOUR_GSHEETS_CREDENTIAL_ID", "name": "Google Sheets OAuth2" } }
    },
    {
      "parameters": {
        "url": "=https://{{ $json['Domain'] }}",
        "options": { "response": { "response": { "fullResponse": false } } }
      },
      "id": "g1h2i3j4-0002-0002-0002-000000000002",
      "name": "Scrape Website",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [460, 300]
    },
    {
      "parameters": {
        "url": "=https://api.serper.dev/search",
        "method": "POST",
        "sendHeaders": true,
        "headerParameters": { "parameters": [{ "name": "X-API-KEY", "value": "YOUR_SERPER_API_KEY" }] },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [{ "name": "q", "value": "={{ $('Get Company List').item.json['Company Name'] + ' company pricing product' }}" }]
        }
      },
      "id": "g1h2i3j4-0003-0003-0003-000000000003",
      "name": "Google Search",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [460, 480]
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "create",
        "model": "claude-3-5-sonnet-20241022",
        "messages": {
          "values": [
            {
              "role": "user",
              "content": "=You are a GTM research analyst. Analyse this company and extract GTM intelligence.\n\nCompany: {{ $('Get Company List').item.json['Company Name'] }}\nDomain: {{ $('Get Company List').item.json['Domain'] }}\n\nWebsite content (first 2000 chars): {{ $('Scrape Website').item.json.data?.slice(0, 2000) || 'Not available' }}\n\nSearch results: {{ JSON.stringify($('Google Search').item.json.organic?.slice(0, 3)) }}\n\nExtract and return as JSON:\n{\n  \"market_type\": \"B2B/B2C/Both\",\n  \"industry\": \"primary industry\",\n  \"target_audience\": \"who they sell to\",\n  \"value_proposition\": \"one sentence\",\n  \"pricing_model\": \"subscription/one-time/usage-based/unknown\",\n  \"free_trial\": true/false,\n  \"key_integrations\": [\"up to 5 tools they integrate with\"],\n  \"icp_fit_signals\": \"why a GTM engineer would or would not care about this company\",\n  \"cold_opener\": \"a personalised 1-sentence cold email opener referencing something specific about them\"\n}"
            }
          ]
        }
      },
      "id": "g1h2i3j4-0004-0004-0004-000000000004",
      "name": "Claude Research Agent",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [700, 380],
      "credentials": { "openAiApi": { "id": "YOUR_ANTHROPIC_CREDENTIAL_ID", "name": "Anthropic API" } }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "id": "1", "name": "research", "value": "={{ JSON.parse($json.message.content) }}", "type": "object" }
          ]
        }
      },
      "id": "g1h2i3j4-0005-0005-0005-000000000005",
      "name": "Parse Research",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [940, 380]
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": { "value": "YOUR_GOOGLE_SHEET_ID" },
        "sheetName": "Companies",
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Market Type": "={{ $json.research.market_type }}",
            "Industry": "={{ $json.research.industry }}",
            "Target Audience": "={{ $json.research.target_audience }}",
            "Value Proposition": "={{ $json.research.value_proposition }}",
            "Pricing Model": "={{ $json.research.pricing_model }}",
            "Free Trial": "={{ $json.research.free_trial }}",
            "Integrations": "={{ $json.research.key_integrations.join(', ') }}",
            "ICP Fit": "={{ $json.research.icp_fit_signals }}",
            "Cold Opener": "={{ $json.research.cold_opener }}",
            "Enriched": "YES"
          }
        }
      },
      "id": "g1h2i3j4-0006-0006-0006-000000000006",
      "name": "Write to Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4,
      "position": [1160, 380],
      "credentials": { "googleSheetsOAuth2Api": { "id": "YOUR_GSHEETS_CREDENTIAL_ID", "name": "Google Sheets OAuth2" } }
    }
  ],
  "connections": {
    "Get Company List": {
      "main": [[{ "node": "Scrape Website", "type": "main", "index": 0 }, { "node": "Google Search", "type": "main", "index": 0 }]]
    },
    "Scrape Website": { "main": [[{ "node": "Claude Research Agent", "type": "main", "index": 0 }]] },
    "Google Search": { "main": [[{ "node": "Claude Research Agent", "type": "main", "index": 0 }]] },
    "Claude Research Agent": { "main": [[{ "node": "Parse Research", "type": "main", "index": 0 }]] },
    "Parse Research": { "main": [[{ "node": "Write to Sheet", "type": "main", "index": 0 }]] }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "versionId": "g1h2i3j4-aaaa-bbbb-cccc-000000000007",
  "meta": { "templateCredsSetupCompleted": false },
  "id": "workflow-company-research-agent",
  "tags": [{ "name": "GTM" }, { "name": "Research" }, { "name": "Claude" }]
}
