{ "kind": "open-flow-workflow", "version": 1, "name": "Webhook Request Classifier", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_866640225956770b": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_1de45a91fc5310ec", "output": "response" } ] } }, "name": "Return classification", "kind": "webhook-response" }, "n_d7c004b8ef3a4c9e": { "name": "Incoming request", "kind": "webhook", "bodyFields": [ { "jsonSchema": {}, "nullable": false, "handle": "request" } ], "method": "POST", "options": { "responseBody": { "kind": "webhook-response", "nodeId": "n_866640225956770b", "timeoutMs": 60000 } } }, "n_441379f81b1d6cc3": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d7c004b8ef3a4c9e", "output": "body" } ] } }, "name": "Prepare request", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "body" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "requestJson" } ], "name": "Prepare request", "moduleId": "n_d285d9b9765e609a", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_9774d733944366a0": { "inputs": { "requestJson": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_441379f81b1d6cc3", "output": "requestJson" } ] } }, "name": "Classify request", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "items": { "type": "object" }, "type": "array" }, "nullable": true, "handle": "messages", "value": null }, { "jsonSchema": { "items": { "type": "object" }, "minItems": 1, "type": "array" }, "nullable": false, "handle": "template", "value": [ { "role": "system", "content": "You are a request classifier. Analyze the incoming request and respond with ONLY a JSON object: {\"route\": \"\", \"priority\": \"high|medium|low\", \"summary\": \"\"}\n\nAvailable routes: support, sales, technical, general" }, { "role": "user", "content": "Classify this request: {{requestJson}}" } ] }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "model", "value": { "model": "claude-haiku-4-5", "max_tokens": 100 } }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "requestJson" } ], "outputs": [ { "description": "Generated response.", "jsonSchema": { "type": "string" }, "nullable": false, "handle": "output" } ], "name": "Classify request", "executor": { "kind": "llm", "mode": "chat" } } }, "n_1de45a91fc5310ec": { "inputs": { "text": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_9774d733944366a0", "output": "output" } ] } }, "name": "Parse classification", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "text" } ], "outputs": [ { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "response" } ], "name": "Parse classification", "moduleId": "n_9cd34477df776c31", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } } }, "edges": [ { "source": "n_d7c004b8ef3a4c9e", "target": "n_441379f81b1d6cc3" }, { "source": "n_441379f81b1d6cc3", "target": "n_9774d733944366a0" }, { "source": "n_9774d733944366a0", "target": "n_1de45a91fc5310ec" }, { "source": "n_1de45a91fc5310ec", "target": "n_866640225956770b" } ] } }, "modules": { "n_d285d9b9765e609a": { "name": "Prepare request", "imports": [], "source": "export default function classifierRequest({ body }) {\n if (body === null || typeof body !== 'object' || !Object.hasOwn(body, 'request')) {\n throw new Error('Provide the request to classify in the request field');\n }\n return { requestJson: JSON.stringify(body.request) };\n}\n" }, "n_9cd34477df776c31": { "name": "Parse classification", "imports": [], "source": "export default function classifierResult({ text }) {\n let parsed;\n try {\n const raw = text.trim();\n try { parsed = JSON.parse(raw); }\n catch { parsed = JSON.parse(raw.slice(raw.indexOf('{'), raw.lastIndexOf('}') + 1)); }\n if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) throw new Error('Expected an object');\n } catch {\n parsed = { route: 'general', priority: 'medium', summary: 'Unable to classify' };\n }\n const route = typeof parsed.route === 'string' ? parsed.route.toLowerCase() : '';\n const priority = typeof parsed.priority === 'string' ? parsed.priority.toLowerCase() : '';\n return {\n response: {\n received: true,\n route: ['support', 'sales', 'technical', 'general'].includes(route) ? route : 'general',\n priority: ['high', 'medium', 'low'].includes(priority) ? priority : 'medium',\n summary: typeof parsed.summary === 'string' ? parsed.summary : '',\n },\n };\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }