{ "kind": "open-flow-workflow", "version": 1, "name": "Human Support Escalation", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_fb8aff0fab5cd400": { "name": "Support request text", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "chatInput" } ] }, "n_4bc9d06674487c57": { "inputs": { "chatInput": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_fb8aff0fab5cd400", "output": "chatInput" } ] } }, "name": "Check contact email", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "chatInput" } ], "outputs": [ { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "hasEmail" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "text" } ], "name": "Check contact email", "moduleId": "n_89bb4eb733f8dbec", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_4930770ced7e405d": { "inputs": {}, "name": "Email included?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "without_email", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_4bc9d06674487c57", "output": "hasEmail" } }, "operator": "==", "right": { "kind": "value", "value": false } } ] } ] } ] }, "n_2e526ec3f97cc027": { "inputs": { "channelId": { "kind": "value", "value": "YOUR_SLACK_SUPPORT_CHANNEL_ID" }, "text": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4bc9d06674487c57", "output": "text" } ] } }, "name": "Notify human support", "kind": "task", "task": { "inputs": [ { "description": "The Slack conversation or channel ID.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The Slack conversation or channel ID." }, "nullable": false, "handle": "channelId" }, { "description": "Plain text message content. When blocks are provided, Slack uses this as notification and accessibility fallback text.", "jsonSchema": { "type": "string", "description": "Plain text message content. When blocks are provided, Slack uses this as notification and accessibility fallback text." }, "nullable": true, "handle": "text", "value": null }, { "description": "Slack Block Kit blocks to render in the message.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": {}, "additionalProperties": true, "description": "A Slack Block Kit block object. Pass the block exactly as Slack documents it." }, "minItems": 1, "description": "Slack Block Kit blocks to render in the message." }, "nullable": true, "handle": "blocks", "value": null }, { "description": "Slack legacy attachments to include in the message.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": {}, "additionalProperties": true, "description": "A Slack legacy attachment object. Prefer blocks for new messages when possible." }, "minItems": 1, "description": "Slack legacy attachments to include in the message." }, "nullable": true, "handle": "attachments", "value": null }, { "description": "Whether Slack should unfurl links in the message.", "jsonSchema": { "type": "boolean", "description": "Whether Slack should unfurl links in the message." }, "nullable": true, "handle": "unfurlLinks", "value": null }, { "description": "Whether Slack should unfurl media in the message.", "jsonSchema": { "type": "boolean", "description": "Whether Slack should unfurl media in the message." }, "nullable": true, "handle": "unfurlMedia", "value": null }, { "description": "Slack message metadata to attach to the message.", "jsonSchema": { "type": "object", "properties": {}, "additionalProperties": true, "description": "Slack message metadata to attach to the message." }, "nullable": true, "handle": "metadata", "value": null } ], "outputs": [ { "description": "The timestamp identifier of the posted message.", "jsonSchema": { "type": "string", "description": "The timestamp identifier of the posted message." }, "nullable": false, "handle": "ts" }, { "description": "The channel ID where the message was posted.", "jsonSchema": { "type": "string", "description": "The channel ID where the message was posted." }, "nullable": false, "handle": "channelId" } ], "name": "Notify human support", "executor": { "kind": "connector", "action": "slack.post_message" } } }, "n_bde37dbeadd8ddae": { "inputs": { "delivered": { "kind": "value", "value": true }, "ts": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2e526ec3f97cc027", "output": "ts" } ] }, "channelId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2e526ec3f97cc027", "output": "channelId" } ] } }, "name": "Confirm support notification", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "delivered" }, { "jsonSchema": { "type": "string", "description": "The timestamp identifier of the posted message." }, "nullable": false, "handle": "ts" }, { "jsonSchema": { "type": "string", "description": "The channel ID where the message was posted." }, "nullable": false, "handle": "channelId" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "response" } ], "name": "Confirm support notification", "moduleId": "n_fa6aefc6f0abac74", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_fcd46107f9ae0e66": { "inputs": { "delivered": { "kind": "value", "value": false }, "ts": { "kind": "value", "value": "" }, "channelId": { "kind": "value", "value": "" } }, "name": "Request contact email", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "delivered" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "ts" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "channelId" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "response" } ], "name": "Request contact email", "moduleId": "n_11b89d3fc62da5fe", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_650db1cf661a07dd": { "name": "Support handoff response", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "response" } ], "outputMappings": { "response": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_bde37dbeadd8ddae", "output": "response" }, { "kind": "node", "nodeId": "n_fcd46107f9ae0e66", "output": "response" } ] } } } }, "edges": [ { "source": "n_fb8aff0fab5cd400", "target": "n_4bc9d06674487c57" }, { "source": "n_4bc9d06674487c57", "target": "n_4930770ced7e405d" }, { "source": "n_4930770ced7e405d", "target": "n_2e526ec3f97cc027", "sourceHandle": "otherwise" }, { "source": "n_2e526ec3f97cc027", "target": "n_bde37dbeadd8ddae" }, { "source": "n_bde37dbeadd8ddae", "target": "n_650db1cf661a07dd" }, { "source": "n_4930770ced7e405d", "target": "n_fcd46107f9ae0e66", "sourceHandle": "without_email" }, { "source": "n_fcd46107f9ae0e66", "target": "n_650db1cf661a07dd" } ] } }, "modules": { "n_89bb4eb733f8dbec": { "name": "Check contact email", "imports": [], "source": "export const supportMessagePrefix = \"A user had a question the bot couldn't answer. Here's their message: \";\n\nexport default function prepareHumanSupport({ chatInput }) {\n if (typeof chatInput !== 'string' || !chatInput.trim()) throw new Error('Supply the question or support request as text.');\n const hasEmail = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.[a-zA-Z0-9_-]+)/i.test(chatInput);\n const text = supportMessagePrefix + chatInput;\n if (hasEmail && text.length > 40000) throw new Error('The support message exceeds the 40,000-character budget.');\n return { hasEmail, text };\n}\n" }, "n_fa6aefc6f0abac74": { "name": "Confirm support notification", "imports": [], "source": "export const missingEmailResponse = \"I'm sorry I don't know the answer. Please repeat your question and include your email address so I can request help.\";\nexport const supportNotifiedResponse = \"Thank you for getting in touch. I've messaged a human to help.\";\n\nexport default function humanSupportReply({ delivered, ts, channelId }) {\n if (!delivered) return { response: missingEmailResponse };\n if (typeof ts !== 'string' || !ts.trim() || typeof channelId !== 'string' || !channelId.trim()) throw new Error('Slack did not acknowledge the support message.');\n return { response: supportNotifiedResponse };\n}\n" }, "n_11b89d3fc62da5fe": { "name": "Request contact email", "imports": [], "source": "export const missingEmailResponse = \"I'm sorry I don't know the answer. Please repeat your question and include your email address so I can request help.\";\nexport const supportNotifiedResponse = \"Thank you for getting in touch. I've messaged a human to help.\";\n\nexport default function humanSupportReply({ delivered, ts, channelId }) {\n if (!delivered) return { response: missingEmailResponse };\n if (typeof ts !== 'string' || !ts.trim() || typeof channelId !== 'string' || !channelId.trim()) throw new Error('Slack did not acknowledge the support message.');\n return { response: supportNotifiedResponse };\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }