{
  "name": "HubSpot Inbound Request Routing",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "hubspot-inbound-request",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "a831fc3b-9f24-43f1-9f6b-01c1d4c12f23",
      "name": "Receive approved inbound request",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -680,
        0
      ]
    },
    {
      "parameters": {
        "jsCode": "const body = $json.body || $json;\nconst message = String(body.message || body.request || body.notes || '').trim();\nconst customer = body.customer || body.company || body.email || 'unknown';\nreturn [{ json: {\n  customer,\n  email: body.email || '',\n  source: body.source || 'website_form',\n  requestText: message,\n  requestedService: body.service || body.topic || 'general',\n  receivedAt: new Date().toISOString()\n}}];"
      },
      "id": "fd044a57-d7bf-4bf2-a870-f1f99725d8b9",
      "name": "Normalize request fields",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -420,
        0
      ]
    },
    {
      "parameters": {
        "model": "gpt-4o-mini",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You classify inbound customer requests that were intentionally submitted through owned forms or support channels. Do not build external recipient databases, do not enrich unknown people, and do not prepare promotional messages unless the customer clearly initiated the request and consent is documented. Output strict JSON with urgency, category, ownerTeam, nextAction, riskNotes."
            },
            {
              "role": "user",
              "content": "Request JSON: {{$json}}"
            }
          ]
        },
        "options": {
          "temperature": 0.1
        }
      },
      "id": "f0d57fb6-f544-4f0c-b01c-dfb578b476b4",
      "name": "Classify inbound request",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        -150,
        0
      ],
      "credentials": {
        "openAiApi": {
          "id": "REPLACE_WITH_OPENAI_CREDENTIAL",
          "name": "OpenAI account"
        }
      }
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "resource": "ticket",
        "operation": "create",
        "additionalFields": {
          "subject": "={{'Inbound request: ' + $node['Normalize request fields'].json.requestedService}}",
          "content": "={{$node['Normalize request fields'].json.requestText}}"
        }
      },
      "id": "d868c77d-13ee-480c-988f-44c7b407d9b8",
      "name": "Create HubSpot ticket",
      "type": "n8n-nodes-base.hubspot",
      "typeVersion": 2.1,
      "position": [
        130,
        -110
      ],
      "credentials": {
        "hubspotOAuth2Api": {
          "id": "REPLACE_WITH_HUBSPOT_CREDENTIAL",
          "name": "HubSpot account"
        }
      }
    },
    {
      "parameters": {
        "text": "={{'Inbound request routed: ' + $node['Normalize request fields'].json.customer + '\\nService: ' + $node['Normalize request fields'].json.requestedService + '\\nReview the HubSpot ticket before any external action.'}}",
        "otherOptions": {}
      },
      "id": "a5eb7c01-9f12-4911-b1f2-e6d41879f4b2",
      "name": "Notify internal team",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        130,
        120
      ],
      "credentials": {
        "slackOAuth2Api": {
          "id": "REPLACE_WITH_SLACK_CREDENTIAL",
          "name": "Slack account"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\"ok\": true, \"message\": \"Request received and routed for internal review.\"}",
        "options": {}
      },
      "id": "a851b19d-cde8-4bc7-93d3-4f25bfb8ef37",
      "name": "Return confirmation",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        430,
        0
      ]
    }
  ],
  "connections": {
    "Receive approved inbound request": {
      "main": [
        [
          {
            "node": "Normalize request fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize request fields": {
      "main": [
        [
          {
            "node": "Classify inbound request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify inbound request": {
      "main": [
        [
          {
            "node": "Create HubSpot ticket",
            "type": "main",
            "index": 0
          },
          {
            "node": "Notify internal team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create HubSpot ticket": {
      "main": [
        [
          {
            "node": "Return confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    {
      "name": "inbound"
    },
    {
      "name": "support"
    },
    {
      "name": "crm"
    }
  ],
  "triggerCount": 1,
  "updatedAt": "2026-05-24T00:00:00.000Z",
  "versionId": "f8d0d2a0-6a54-4c86-9f57-d0a8a30f4fd4"
}
