{
  "name": "CodeBrewerz — Lead router",
  "nodes": [
    {
      "parameters": {
        "content": "## Lead router\n\nReceives a contact-form submission on a webhook, normalises it, routes\nconsultation enquiries to a priority Slack channel and everything else to the\ngeneral inbox, then sends the sender an acknowledgement.\n\n### Before you activate it\n\n1. Open **Webhook** and copy the production URL into your form's POST target.\n   The expected JSON body is `{ name, email, interest, message }`.\n2. Create a **Slack** credential (OAuth2 or a bot token with `chat:write`) and\n   attach it to both Slack nodes. Change `#sales` and `#inbox` to your channels.\n3. Create an **SMTP** credential and attach it to *Send acknowledgement*, then\n   set the From address to one your domain is allowed to send as.\n4. Test with **Execute workflow**, then activate.\n\nNo credentials ship with this file — nothing here references an account you do\nnot own.\n\nMIT licensed. Review it before you point production traffic at it.",
        "height": 460,
        "width": 420
      },
      "id": "6f0f1a2c-0001-4a10-9f01-2b3c4d5e6f70",
      "name": "Setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [-460, 60]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "codebrewerz-lead",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "6f0f1a2c-0002-4a10-9f01-2b3c4d5e6f70",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [0, 300],
      "webhookId": "6f0f1a2c-0002-4a10-9f01-2b3c4d5e6f70"
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "fullName",
              "value": "={{ $json.body.name }}"
            },
            {
              "name": "email",
              "value": "={{ $json.body.email }}"
            },
            {
              "name": "interest",
              "value": "={{ ($json.body.interest || 'unspecified').toString().toLowerCase() }}"
            },
            {
              "name": "message",
              "value": "={{ $json.body.message }}"
            },
            {
              "name": "receivedAt",
              "value": "={{ $now.toISO() }}"
            }
          ]
        },
        "options": {}
      },
      "id": "6f0f1a2c-0003-4a10-9f01-2b3c4d5e6f70",
      "name": "Normalise lead",
      "type": "n8n-nodes-base.set",
      "typeVersion": 2,
      "position": [220, 300]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.interest }}",
              "operation": "equal",
              "value2": "consultation"
            }
          ]
        }
      },
      "id": "6f0f1a2c-0004-4a10-9f01-2b3c4d5e6f70",
      "name": "Consultation?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [440, 300]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": "#sales",
        "text": "=:fire: *Consultation request* from {{ $json.fullName }} <{{ $json.email }}>\n\n{{ $json.message }}\n\n_Received {{ $json.receivedAt }} — reply within one business day._",
        "otherOptions": {}
      },
      "id": "6f0f1a2c-0005-4a10-9f01-2b3c4d5e6f70",
      "name": "Notify sales",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2,
      "position": [680, 180]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": "#inbox",
        "text": "=New enquiry ({{ $json.interest }}) from {{ $json.fullName }} <{{ $json.email }}>\n\n{{ $json.message }}",
        "otherOptions": {}
      },
      "id": "6f0f1a2c-0006-4a10-9f01-2b3c4d5e6f70",
      "name": "Notify inbox",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2,
      "position": [680, 420]
    },
    {
      "parameters": {
        "fromEmail": "hello@example.com",
        "toEmail": "={{ $json.email }}",
        "subject": "=We got your message, {{ $json.fullName }}",
        "text": "=Thanks for getting in touch.\n\nSomeone will read this and reply within one business day.\n\n— The team",
        "options": {}
      },
      "id": "6f0f1a2c-0007-4a10-9f01-2b3c4d5e6f70",
      "name": "Send acknowledgement",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2,
      "position": [920, 300]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ ok: true }) }}",
        "options": {}
      },
      "id": "6f0f1a2c-0008-4a10-9f01-2b3c4d5e6f70",
      "name": "Respond ok",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [1140, 300]
    }
  ],
  "pinData": {},
  "connections": {
    "Webhook": {
      "main": [[{ "node": "Normalise lead", "type": "main", "index": 0 }]]
    },
    "Normalise lead": {
      "main": [[{ "node": "Consultation?", "type": "main", "index": 0 }]]
    },
    "Consultation?": {
      "main": [
        [{ "node": "Notify sales", "type": "main", "index": 0 }],
        [{ "node": "Notify inbox", "type": "main", "index": 0 }]
      ]
    },
    "Notify sales": {
      "main": [[{ "node": "Send acknowledgement", "type": "main", "index": 0 }]]
    },
    "Notify inbox": {
      "main": [[{ "node": "Send acknowledgement", "type": "main", "index": 0 }]]
    },
    "Send acknowledgement": {
      "main": [[{ "node": "Respond ok", "type": "main", "index": 0 }]]
    }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "versionId": "6f0f1a2c-1000-4a10-9f01-2b3c4d5e6f70",
  "meta": { "templateCredsSetupCompleted": false },
  "tags": []
}
