{ "kind": "open-flow-workflow", "version": 1, "name": "Notify Slack When a Workflow Fails", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_0099fb4fc544b39b": { "name": "Receive a workflow failure", "kind": "error", "sourceFlowIds": [] }, "n_f8df64b206337c06": { "inputs": { "workflow": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_0099fb4fc544b39b", "output": "workflow" } ] }, "execution": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_0099fb4fc544b39b", "output": "execution" } ] } }, "name": "Prepare the Slack alert", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "workflow" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "execution" } ], "outputs": [ { "jsonSchema": { "type": "string", "description": "Plain text message content. When blocks are provided, Slack uses this as notification and accessibility fallback text." }, "nullable": true, "handle": "message" } ], "name": "Prepare the Slack alert", "moduleId": "n_892d1f8ae8d2616f", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_63cbd340bbad3da7": { "inputs": { "channelId": { "kind": "value", "value": "YOUR_SLACK_CHANNEL_ID" }, "text": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f8df64b206337c06", "output": "message" } ] } }, "name": "Send the Slack alert", "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": "Send the Slack alert", "executor": { "kind": "connector", "action": "slack.post_message" } } } }, "edges": [ { "source": "n_0099fb4fc544b39b", "target": "n_f8df64b206337c06" }, { "source": "n_f8df64b206337c06", "target": "n_63cbd340bbad3da7" } ] } }, "modules": { "n_892d1f8ae8d2616f": { "name": "Prepare the Slack alert", "imports": [], "source": "export default function slackErrorIdentity({workflow,execution}) {\n if(!workflow||typeof workflow.name!=='string'||!workflow.name||!execution||typeof execution.runId!=='string'||!execution.runId)throw Error('Missing workflow or run identity');\n const esc=s=>s.replace(/&/g,'&').replace(//g,'>');\n return {message:`🐞 What?!\\n*This execution ${esc(workflow.name)} went wrong*\\nRun ID: ${esc(execution.runId)}`};\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }