{ "name": "Workflow A – Mail Processing & KI Analysis", "description": "Automated workflow to process support tickets, analyze them with AI, search knowledge base, and provide intelligent suggestions.", "nodes": [ { "id": "uuid-trigger-1", "name": "Cron Trigger", "type": "n8n-nodes-base.cron", "typeVersion": 1, "position": [ 250, 200 ], "parameters": { "cronExpression": "*/5 * * * *", "timezone": "Europe/Berlin" } }, { "id": "uuid-freescout-1", "name": "Freescout Get Conversations", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4, "position": [ 450, 200 ], "parameters": { "authentication": "predefinedCredentialType", "url": "https://ekshelpdesk.fft-it.de/api/v1/mailboxes/1/conversations", "method": "GET", "options": {}, "sendQuery": true, "queryParameters": { "parameters": [ { "name": "status", "value": "active" }, { "name": "limit", "value": "20" }, { "name": "processed_by_ai", "value": "false" } ] } }, "credentials": { "httpBasicAuth": "Freescout API" } }, { "id": "uuid-loop-1", "name": "Loop Through Conversations", "type": "n8n-nodes-base.loop", "typeVersion": 1, "position": [ 650, 200 ], "parameters": { "iterations": "={{ $json.body._embedded.conversations.length }}", "dataPropertyName": "body._embedded.conversations" } }, { "id": "uuid-set-extract-1", "name": "Extract Conversation Data", "type": "n8n-nodes-base.set", "typeVersion": 3, "position": [ 850, 200 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "name": "ticket_id", "value": "={{ $json.id }}", "type": "string" }, { "name": "subject", "value": "={{ $json.subject }}", "type": "string" }, { "name": "problem_text", "value": "={{ $json.threads[0].body || 'No description' }}", "type": "string" }, { "name": "customer_name", "value": "={{ $json.customer_name }}", "type": "string" }, { "name": "status", "value": "={{ $json.status }}", "type": "string" }, { "name": "mailbox_id", "value": 1, "type": "number" } ] } } }, { "id": "uuid-milvus-query-1", "name": "Milvus Query KB", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4, "position": [ 1050, 200 ], "parameters": { "authentication": "none", "url": "http://milvus:9091/api/v1/search", "method": "POST", "headers": { "Content-Type": "application/json" }, "sendBody": true, "specifyBody": "json", "jsonBody": "={\"collection_name\":\"knowledge_base_embeddings\",\"search_params\":{\"metric_type\":\"L2\",\"params\":{\"nprobe\":10}},\"annnSearch\":{\"field\":\"embedding\",\"limit\":3,\"metric_type\":\"L2\"},\"output_fields\":[\"title\",\"content\",\"category\",\"solution_type\",\"created_at\"]}" } }, { "id": "uuid-llm-call-1", "name": "LiteLLM AI Analysis", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4, "position": [ 1250, 200 ], "parameters": { "authentication": "none", "url": "http://llm:8000/v1/chat/completions", "method": "POST", "headers": { "Content-Type": "application/json" }, "sendBody": true, "specifyBody": "json", "jsonBody": "={\"model\":\"gpt-3.5-turbo\",\"messages\":[{\"role\":\"system\",\"content\":\"Du bist ein IT-Support-Assistent. Analysiere das folgende Support-Ticket und: 1. Verstehe das Problem 2. Schaue in der Wissensdatenbank nach ähnlichen Problemen 3. Gib einen strukturierten Vorschlag zurück als JSON. Die Lösung kann sein: BARAMUNDI_JOB (Ein automatisierter Job im Baramundi System), AUTOMATISCHE_ANTWORT (Eine automatische Antwort an den Kunden), ESKALATION (Manuelle Eskalation erforderlich)\"},{\"role\":\"user\",\"content\":\"Ticket ID: ={{$json.ticket_id}} Subjekt: ={{$json.subject}} Problem: ={{$json.problem_text}} Gib deine Analyse als JSON zurück mit kategorie, problem_verstanden, lösung_typ, baramundi_job, antwort_text, vertrauen (0.0-1.0), und begründung.\"}],\"temperature\":0.7,\"max_tokens\":1000}" } }, { "id": "uuid-parse-response-1", "name": "Parse AI Response", "type": "n8n-nodes-base.set", "typeVersion": 3, "position": [ 1450, 200 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "name": "ai_response_raw", "value": "={{ $json.choices[0].message.content }}", "type": "string" }, { "name": "ai_response", "value": "={{ JSON.parse($json.ai_response_raw) }}", "type": "object" } ] } } }, { "id": "uuid-filter-confidence-1", "name": "Filter by Confidence", "type": "n8n-nodes-base.if", "typeVersion": 2, "position": [ 1650, 200 ], "parameters": { "conditions": { "options": { "caseSensitive": true, "extractValue": false }, "combinator": "and", "conditions": [ { "id": "condition_1", "leftValue": "={{ $json.ai_response.vertrauen }}", "rightValue": 0.6, "operator": { "name": "filter.operator.gte", "value": ">=" } } ] } } }, { "id": "uuid-freescout-update-1", "name": "Freescout Save Suggestion", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4, "position": [ 1850, 100 ], "parameters": { "authentication": "predefinedCredentialType", "url": "=https://ekshelpdesk.fft-it.de/api/v1/conversations/{{ $json.ticket_id }}", "method": "PUT", "headers": { "Content-Type": "application/json" }, "sendBody": true, "specifyBody": "json", "jsonBody": "={\"custom_fields\":{\"AI_SUGGESTION\":={{$json.ai_response.antwort_text}},\"AI_SUGGESTION_STATUS\":\"PENDING\",\"PROCESSED_BY_AI\":true,\"AI_CATEGORY\":={{$json.ai_response.kategorie}},\"AI_CONFIDENCE\":={{$json.ai_response.vertrauen}},\"AI_SOLUTION_TYPE\":={{$json.ai_response.lösung_typ}},\"AI_REASONING\":={{$json.ai_response.begründung}}}}" }, "credentials": { "httpBasicAuth": "Freescout API" } }, { "id": "uuid-no-action-1", "name": "Low Confidence - No Action", "type": "n8n-nodes-base.set", "typeVersion": 3, "position": [ 1850, 350 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "name": "skip_reason", "value": "Confidence below threshold ({{ $json.ai_response.vertrauen }} < 0.6)", "type": "string" }, { "name": "processed", "value": false, "type": "boolean" } ] } } } ], "connections": { "Cron Trigger": { "main": [ [ { "node": "Freescout Get Conversations", "index": 0 } ] ] }, "Freescout Get Conversations": { "main": [ [ { "node": "Loop Through Conversations", "index": 0 } ] ] }, "Loop Through Conversations": { "main": [ [ { "node": "Extract Conversation Data", "index": 0 } ] ] }, "Extract Conversation Data": { "main": [ [ { "node": "Milvus Query KB", "index": 0 } ] ] }, "Milvus Query KB": { "main": [ [ { "node": "LiteLLM AI Analysis", "index": 0 } ] ] }, "LiteLLM AI Analysis": { "main": [ [ { "node": "Parse AI Response", "index": 0 } ] ] }, "Parse AI Response": { "main": [ [ { "node": "Filter by Confidence", "index": 0 } ] ] }, "Filter by Confidence": { "main": [ [ { "node": "Freescout Save Suggestion", "index": 0 } ], [ { "node": "Low Confidence - No Action", "index": 0 } ] ] } }, "active": false, "settings": { "errorHandler": "continueOnError", "timezone": "Europe/Berlin" }, "owner": "admin", "versionId": "1" }