{ "name": "AI Support Triage", "nodes": [ { "parameters": { "assignments": { "assignments": [ { "id": "c6efef01-f123-4a4d-97e4-0a5a6ca843f0", "name": "classification_text", "value": "={{ $json.output[0].content[0].text }}", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -144, -688 ], "id": "e2349baa-27f1-4932-b2b3-1e59c766948c", "name": "Capture Classification Output" }, { "parameters": { "assignments": { "assignments": [ { "id": "50560156-2d0a-42f3-a963-edd514fe9cb4", "name": "classification_clean", "value": "={{$json.classification_text\n .replace(/```json|```/g, '')\n .trim()\n .replace(/^[^{]*({[\\s\\S]*})[^}]*$/, '$1')\n}}\n", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 80, -688 ], "id": "af014630-6b6c-4329-887c-e57c57b0b98b", "name": "Clean Classification Output" }, { "parameters": { "assignments": { "assignments": [ { "id": "f8c49650-1545-45ad-9d8e-f15f1fc3de13", "name": "=classification_parsed", "value": "={{ JSON.parse($json.classification_clean) }}", "type": "object" } ] }, "includeOtherFields": "={{ false }}", "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 304, -688 ], "id": "a8779400-0c98-4640-8417-72b1186a3df5", "name": "Parse Classification" }, { "parameters": { "httpMethod": "POST", "path": "support-ticket", "responseMode": "responseNode", "options": {} }, "type": "n8n-nodes-base.webhook", "typeVersion": 2.1, "position": [ -944, -688 ], "id": "f5234f3a-db3a-460e-8259-441cbbcbefe8", "name": "Webhook Intake", "webhookId": "57035dfb-dfad-48d5-8488-22fcb3fda44a" }, { "parameters": { "assignments": { "assignments": [ { "id": "09b0fe0c-d70e-4c5e-91fb-c47ad4fe0843", "name": "ticket_message", "value": "={{ $json.body.message }}", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -720, -688 ], "id": "4bbc1ba7-8d0c-4110-a3f2-20ffab8ca08f", "name": "Data Normalization" }, { "parameters": { "modelId": { "__rl": true, "value": "gpt-4.1-mini", "mode": "list", "cachedResultName": "GPT-4.1-MINI" }, "responses": { "values": [ { "content": "=You are a support ticket triage system.\n\nAnalyze the following support message and return ONLY valid JSON with this structure:\n{\n \"category\": \"Billing | Bug | Feature Request | Account | Other\",\n \"urgency\": \"Low | Medium | High\",\n \"confidence\": 0.0\n}\n\nSupport message:\n{{ $json.ticket_message }}\n" } ] }, "builtInTools": {}, "options": { "temperature": 0 } }, "type": "@n8n/n8n-nodes-langchain.openAi", "typeVersion": 2.1, "position": [ -496, -688 ], "id": "8fa34cae-fdbf-46ce-9f12-04609c98b96c", "name": "AI Classification (LLM)", "credentials": { "openAiApi": { "id": "OZzPN9YDazkGLjwc", "name": "OpenAi account" } } }, { "parameters": { "assignments": { "assignments": [ { "id": "519d6c3b-113d-4c40-9bc9-7a0011eab564", "name": "=category", "value": "={{ $json.classification_parsed.category }}", "type": "string" }, { "id": "8faefef7-8f9a-4ab3-9330-7dcd3eb80e26", "name": "=urgency", "value": "={{ $json.classification_parsed.urgency }}", "type": "string" }, { "id": "4dd8a613-1c34-4ff0-81c1-127bde93fa19", "name": "confidence", "value": "={{ $json.classification_parsed.confidence }}", "type": "number" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 528, -688 ], "id": "c697280b-69a2-46b3-9cde-2287a5cf6718", "name": "Extract Classification Fields" }, { "parameters": { "respondWith": "json", "responseBody": "{\n \"status\": \"stored\"\n}", "options": {} }, "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1.5, "position": [ 976, -688 ], "id": "d769da87-16dd-4d20-8a6d-5c71ae6d064a", "name": "Respond to Webhook" }, { "parameters": { "schema": { "__rl": true, "mode": "list", "value": "public" }, "table": { "__rl": true, "value": "ticket_classifications", "mode": "list", "cachedResultName": "ticket_classifications" }, "columns": { "mappingMode": "defineBelow", "value": { "confidence": "={{ $json.confidence }}", "category": "={{ $json.category }}", "urgency": "={{ $json.urgency }}" }, "matchingColumns": [ "id" ], "schema": [ { "id": "id", "displayName": "id", "required": false, "defaultMatch": true, "display": true, "type": "number", "canBeUsedToMatch": true, "removed": true }, { "id": "created_at", "displayName": "created_at", "required": false, "defaultMatch": false, "display": true, "type": "dateTime", "canBeUsedToMatch": true }, { "id": "category", "displayName": "category", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true }, { "id": "urgency", "displayName": "urgency", "required": false, "defaultMatch": false, "display": true, "type": "string", "canBeUsedToMatch": true }, { "id": "confidence", "displayName": "confidence", "required": false, "defaultMatch": false, "display": true, "type": "number", "canBeUsedToMatch": true } ], "attemptToConvertTypes": false, "convertFieldsToString": false }, "options": {} }, "type": "n8n-nodes-base.postgres", "typeVersion": 2.6, "position": [ 752, -688 ], "id": "21724492-d424-4563-a271-8bdc992c0020", "name": "Store Classification Decision", "credentials": { "postgres": { "id": "MSPNwphcO3LDEhXF", "name": "Postgres account" } } }, { "parameters": { "content": "## Intake & Classification\nThe purpose of this segment is to receive incoming support requests, normalize the input data, and submit the standardized message to the LLM for classification.", "height": 352, "width": 752, "color": 7 }, "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -992, -880 ], "id": "65df4064-525a-4422-a3fd-21d97673c129", "name": "Sticky Note" }, { "parameters": { "content": "## AI Output Processing\nThe purpose of this segment is to capture the AI output, clean and parse it in clearly separated steps, and expose the final classification fields for downstream use. This approach preserves the original model response, ensures safe transformation of human-readable output into machine-usable data, and provides strong observability and debuggability throughout the workflow.", "height": 352, "width": 864, "color": 7 }, "type": "n8n-nodes-base.stickyNote", "position": [ -192, -880 ], "typeVersion": 1, "id": "e6515eb4-8709-48c8-a301-be756ba23d7a", "name": "Sticky Note1" }, { "parameters": { "content": "## Persistence & Response\nThe purpose of this segment is to persist the finalized classification decision to storage and return a structured response to the originating system, ensuring classifications are recorded for auditing and downstream use.", "height": 352, "width": 400, "color": 7 }, "type": "n8n-nodes-base.stickyNote", "position": [ 720, -880 ], "typeVersion": 1, "id": "68642539-3f6d-46d7-bc00-e79470402563", "name": "Sticky Note2" } ], "pinData": {}, "connections": { "Capture Classification Output": { "main": [ [ { "node": "Clean Classification Output", "type": "main", "index": 0 } ] ] }, "Clean Classification Output": { "main": [ [ { "node": "Parse Classification", "type": "main", "index": 0 } ] ] }, "Webhook Intake": { "main": [ [ { "node": "Data Normalization", "type": "main", "index": 0 } ] ] }, "Data Normalization": { "main": [ [ { "node": "AI Classification (LLM)", "type": "main", "index": 0 } ] ] }, "AI Classification (LLM)": { "main": [ [ { "node": "Capture Classification Output", "type": "main", "index": 0 } ] ] }, "Parse Classification": { "main": [ [ { "node": "Extract Classification Fields", "type": "main", "index": 0 } ] ] }, "Extract Classification Fields": { "main": [ [ { "node": "Store Classification Decision", "type": "main", "index": 0 } ] ] }, "Store Classification Decision": { "main": [ [ { "node": "Respond to Webhook", "type": "main", "index": 0 } ] ] } }, "active": false, "settings": { "executionOrder": "v1" }, "versionId": "10af6816-a549-4269-91c1-bbb0f1766d5a", "meta": { "templateCredsSetupCompleted": true, "instanceId": "e3c43a5e5acd19b91a5334f3b8497c29757b3ab64781525b6d8d11fd1059e1b0" }, "id": "q1uSMCi4SjpnSNVN", "tags": [] }