{
  "name": "New Lead to Slack",
  "nodes": [
    {
      "parameters": { "httpMethod": "POST", "path": "new-lead", "responseMode": "responseNode" },
      "id": "b1c2d3e4-0001-0001-0001-000000000001",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [240, 300]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "id": "1", "name": "name", "value": "={{ $json.body.name }}", "type": "string" },
            { "id": "2", "name": "email", "value": "={{ $json.body.email }}", "type": "string" },
            { "id": "3", "name": "company", "value": "={{ $json.body.company }}", "type": "string" },
            { "id": "4", "name": "website", "value": "={{ $json.body.website }}", "type": "string" },
            { "id": "5", "name": "message", "value": "={{ $json.body.message }}", "type": "string" }
          ]
        }
      },
      "id": "b1c2d3e4-0002-0002-0002-000000000002",
      "name": "Extract Lead Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [460, 300]
    },
    {
      "parameters": {
        "url": "=https://api.hunter.io/v2/email-finder?domain={{ $json.website.replace('https://','').replace('http://','').split('/')[0] }}&api_key=YOUR_HUNTER_API_KEY",
        "options": {}
      },
      "id": "b1c2d3e4-0003-0003-0003-000000000003",
      "name": "Enrich Domain",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [680, 300]
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "create",
        "model": "gpt-4o",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a GTM analyst. Given a lead's details, write a 2-sentence brief for a sales team Slack message. Focus on what they likely need and why they reached out. Be direct, no fluff."
            },
            {
              "role": "user",
              "content": "=Lead: {{ $('Extract Lead Data').item.json.name }} from {{ $('Extract Lead Data').item.json.company }}\nMessage: {{ $('Extract Lead Data').item.json.message }}\nDomain data: {{ JSON.stringify($json.data) }}"
            }
          ]
        }
      },
      "id": "b1c2d3e4-0004-0004-0004-000000000004",
      "name": "AI Brief",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [900, 300],
      "credentials": { "openAiApi": { "id": "YOUR_OPENAI_CREDENTIAL_ID", "name": "OpenAI API" } }
    },
    {
      "parameters": {
        "channel": "#inbound-leads",
        "text": "=🟢 *New Inbound Lead*\n\n*Name:* {{ $('Extract Lead Data').item.json.name }}\n*Company:* {{ $('Extract Lead Data').item.json.company }}\n*Email:* {{ $('Extract Lead Data').item.json.email }}\n*Website:* {{ $('Extract Lead Data').item.json.website }}\n\n*AI Brief:* {{ $json.message.content }}\n\n*Their message:* {{ $('Extract Lead Data').item.json.message }}\n\n<{{ $('Extract Lead Data').item.json.website }}|Visit website> · <https://linkedin.com/company/{{ $('Extract Lead Data').item.json.company.toLowerCase().replace(/ /g,'-') }}|LinkedIn>"
      },
      "id": "b1c2d3e4-0005-0005-0005-000000000005",
      "name": "Slack Alert",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 1,
      "position": [1120, 300],
      "credentials": { "slackApi": { "id": "YOUR_SLACK_CREDENTIAL_ID", "name": "Slack API" } }
    },
    {
      "parameters": { "respondWith": "text", "responseBody": "Lead received." },
      "id": "b1c2d3e4-0006-0006-0006-000000000006",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [1120, 460]
    }
  ],
  "connections": {
    "Webhook": { "main": [[{ "node": "Extract Lead Data", "type": "main", "index": 0 }]] },
    "Extract Lead Data": { "main": [[{ "node": "Enrich Domain", "type": "main", "index": 0 }]] },
    "Enrich Domain": { "main": [[{ "node": "AI Brief", "type": "main", "index": 0 }]] },
    "AI Brief": {
      "main": [
        [{ "node": "Slack Alert", "type": "main", "index": 0 }],
        [{ "node": "Respond to Webhook", "type": "main", "index": 0 }]
      ]
    }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "versionId": "b1c2d3e4-aaaa-bbbb-cccc-000000000002",
  "meta": { "templateCredsSetupCompleted": false },
  "id": "workflow-lead-to-slack",
  "tags": [{ "name": "GTM" }, { "name": "Leads" }, { "name": "Slack" }]
}
