{
  "name": "High-Intent Demo Alert — HubSpot → Slack",
  "nodes": [
    {
      "parameters": {
        "eventsUi": {
          "eventValues": [
            {
              "name": "contact.formSubmission"
            }
          ]
        }
      },
      "id": "hubspot-trigger",
      "name": "HubSpot Trigger",
      "type": "n8n-nodes-base.hubspotTrigger",
      "typeVersion": 1,
      "position": [0, 0],
      "webhookId": "hubspot-trigger-id",
      "credentials": {
        "hubspotApi": {
          "id": "credential-id",
          "name": "HubSpot API"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "conditions": [
            {
              "leftValue": "={{ $json.formId }}",
              "rightValue": "YOUR_DEMO_FORM_ID",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        }
      },
      "id": "filter-demo-form",
      "name": "Is Demo Form?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [220, 0]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "=https://api.hubapi.com/crm/v3/objects/contacts/{{ $json.objectId }}",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "hubspotApi",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "properties",
              "value": "firstname,lastname,email,jobtitle,company,numberofemployees,industry,hubspot_owner_id,hs_analytics_source"
            }
          ]
        },
        "options": {}
      },
      "id": "fetch-contact",
      "name": "Fetch Contact",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [440, 0],
      "credentials": {
        "hubspotApi": {
          "id": "credential-id",
          "name": "HubSpot API"
        }
      }
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const contact = $('Fetch Contact').first().json;\nconst props = contact.properties;\n\nconst ownerToSlack = {\n  '12345678': 'U01AAAA',\n  '23456789': 'U02BBBB',\n  '34567890': 'U03CCCC',\n  '45678901': 'U04DDDD',\n};\n\nconst ownerId = props.hubspot_owner_id;\nconst slackUserId = ownerToSlack[ownerId];\n\nif (!slackUserId) {\n  return [{ json: { ...props, contactId: contact.id, slackTarget: '#demo-alerts', isFallback: true } }];\n}\n\nreturn [{ json: {\n  contactId: contact.id,\n  name: `${props.firstname || ''} ${props.lastname || ''}`.trim(),\n  email: props.email,\n  title: props.jobtitle,\n  company: props.company,\n  employees: props.numberofemployees,\n  industry: props.industry,\n  source: props.hs_analytics_source,\n  slackTarget: slackUserId,\n  isFallback: false,\n}}];"
      },
      "id": "resolve-owner",
      "name": "Resolve Owner Slack ID",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [660, 0]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "={{ $json.slackTarget }}",
          "mode": "id"
        },
        "messageType": "block",
        "blocksUi": "={\n  \"blocks\": [\n    {\n      \"type\": \"header\",\n      \"text\": { \"type\": \"plain_text\", \"text\": \"🔥 Demo Booked!\" }\n    },\n    {\n      \"type\": \"section\",\n      \"fields\": [\n        { \"type\": \"mrkdwn\", \"text\": \"*Name:*\\n\" + $json.name },\n        { \"type\": \"mrkdwn\", \"text\": \"*Title:*\\n\" + ($json.title || 'Not provided') },\n        { \"type\": \"mrkdwn\", \"text\": \"*Company:*\\n\" + ($json.company || 'Unknown') },\n        { \"type\": \"mrkdwn\", \"text\": \"*Size:*\\n\" + ($json.employees || 'Unknown') + \" employees\" },\n        { \"type\": \"mrkdwn\", \"text\": \"*Industry:*\\n\" + ($json.industry || 'Unknown') },\n        { \"type\": \"mrkdwn\", \"text\": \"*Source:*\\n\" + ($json.source || 'Unknown') }\n      ]\n    },\n    {\n      \"type\": \"actions\",\n      \"elements\": [\n        {\n          \"type\": \"button\",\n          \"text\": { \"type\": \"plain_text\", \"text\": \"View Contact\" },\n          \"url\": \"https://app.hubspot.com/contacts/YOUR_PORTAL_ID/contact/\" + $json.contactId,\n          \"style\": \"primary\"\n        }\n      ]\n    }\n  ]\n}",
        "otherOptions": {
          "unfurl_links": false
        }
      },
      "id": "send-slack-dm",
      "name": "Send Slack Alert",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [880, 0],
      "credentials": {
        "slackApi": {
          "id": "credential-id",
          "name": "Slack API"
        }
      }
    }
  ],
  "connections": {
    "HubSpot Trigger": {
      "main": [
        [{ "node": "Is Demo Form?", "type": "main", "index": 0 }]
      ]
    },
    "Is Demo Form?": {
      "main": [
        [{ "node": "Fetch Contact", "type": "main", "index": 0 }]
      ]
    },
    "Fetch Contact": {
      "main": [
        [{ "node": "Resolve Owner Slack ID", "type": "main", "index": 0 }]
      ]
    },
    "Resolve Owner Slack ID": {
      "main": [
        [{ "node": "Send Slack Alert", "type": "main", "index": 0 }]
      ]
    }
  },
  "pinData": {},
  "settings": { "executionOrder": "v1" },
  "staticData": null,
  "tags": [],
  "triggerCount": 0,
  "active": false,
  "meta": { "instanceId": "", "templateId": "revi-demo-alerts" }
}
