{ "kind": "open-flow-workflow", "version": 1, "name": "Send Workflow Failure Alerts with Mailgun", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_c379ab43b51ea0d2": { "name": "Receive a workflow failure", "kind": "error", "sourceFlowIds": [] }, "n_17765a563053d7b6": { "inputs": { "workflow": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c379ab43b51ea0d2", "output": "workflow" } ] }, "execution": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c379ab43b51ea0d2", "output": "execution" } ] }, "error": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c379ab43b51ea0d2", "output": "error" } ] } }, "name": "Prepare failure details", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "workflow" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "execution" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "error" } ], "outputs": [ { "jsonSchema": { "type": "string", "minLength": 1, "description": "Message subject line." }, "nullable": true, "handle": "subject" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "Plain text message body." }, "nullable": true, "handle": "body" } ], "name": "Prepare failure details", "moduleId": "n_1639425f028e5d6c", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_fe9374cd346e7569": { "inputs": { "domain": { "kind": "value", "value": "YOUR_MAILGUN_DOMAIN" }, "from": { "kind": "value", "value": "YOUR_VERIFIED_SENDER" }, "to": { "kind": "value", "value": [ "YOUR_ALERT_EMAIL" ] }, "subject": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_17765a563053d7b6", "output": "subject" } ] }, "text": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_17765a563053d7b6", "output": "body" } ] } }, "name": "Send failure email", "kind": "task", "task": { "inputs": [ { "description": "Mailgun sending domain name.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Mailgun sending domain name." }, "nullable": false, "handle": "domain" }, { "description": "Email address for the From header. Friendly name format is supported.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Email address for the From header. Friendly name format is supported." }, "nullable": true, "handle": "from", "value": null }, { "description": "Primary recipients. Mailgun accepts email addresses or friendly name strings.", "jsonSchema": { "type": "array", "items": { "type": "string", "minLength": 1, "description": "Recipient email address or friendly name string." }, "minItems": 1, "description": "Primary recipients. Mailgun accepts email addresses or friendly name strings." }, "nullable": false, "handle": "to" }, { "description": "Carbon copy recipients.", "jsonSchema": { "type": "array", "items": { "type": "string", "minLength": 1, "description": "Carbon copy recipient email address or friendly name string." }, "description": "Carbon copy recipients." }, "nullable": true, "handle": "cc", "value": null }, { "description": "Blind carbon copy recipients.", "jsonSchema": { "type": "array", "items": { "type": "string", "minLength": 1, "description": "Blind carbon copy recipient email address or friendly name string." }, "description": "Blind carbon copy recipients." }, "nullable": true, "handle": "bcc", "value": null }, { "description": "Message subject line.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Message subject line." }, "nullable": true, "handle": "subject", "value": null }, { "description": "Plain text message body.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Plain text message body." }, "nullable": true, "handle": "text", "value": null }, { "description": "HTML message body.", "jsonSchema": { "type": "string", "minLength": 1, "description": "HTML message body." }, "nullable": true, "handle": "html", "value": null }, { "description": "AMP HTML message body.", "jsonSchema": { "type": "string", "minLength": 1, "description": "AMP HTML message body." }, "nullable": true, "handle": "ampHtml", "value": null }, { "description": "Stored Mailgun template name to render for this email.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Stored Mailgun template name to render for this email." }, "nullable": true, "handle": "template", "value": null }, { "description": "Template version tag to render.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Template version tag to render." }, "nullable": true, "handle": "templateVersion", "value": null }, { "description": "Whether Mailgun should generate a text part from the template.", "jsonSchema": { "type": "boolean", "description": "Whether Mailgun should generate a text part from the template." }, "nullable": true, "handle": "templateText", "value": null }, { "description": "Template variables encoded into Mailgun t:variables.", "jsonSchema": { "type": "object", "additionalProperties": { "description": "Template variable value." }, "description": "Template variables encoded into Mailgun t:variables." }, "nullable": true, "handle": "templateVariables", "value": null }, { "description": "Recipient variables for Mailgun batch sending.", "jsonSchema": { "type": "object", "additionalProperties": { "type": "object", "properties": {}, "additionalProperties": true, "description": "Variables for one recipient." }, "description": "Recipient variables for Mailgun batch sending." }, "nullable": true, "handle": "recipientVariables", "value": null }, { "description": "Mailgun tags attached to the message.", "jsonSchema": { "type": "array", "items": { "type": "string", "minLength": 1, "description": "Mailgun tag." }, "description": "Mailgun tags attached to the message." }, "nullable": true, "handle": "tags", "value": null }, { "description": "String map forwarded to Mailgun.", "jsonSchema": { "type": "object", "additionalProperties": { "type": "string", "description": "Map value." }, "description": "String map forwarded to Mailgun." }, "nullable": true, "handle": "headers", "value": null }, { "description": "Custom Mailgun user variables stored with events and webhooks.", "jsonSchema": { "type": "object", "additionalProperties": { "description": "Custom variable value." }, "description": "Custom Mailgun user variables stored with events and webhooks." }, "nullable": true, "handle": "variables", "value": null }, { "description": "Scheduled delivery time in RFC 2822 format.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Scheduled delivery time in RFC 2822 format." }, "nullable": true, "handle": "deliveryTime", "value": null }, { "description": "Maximum delivery window such as 1h30m or 24h.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Maximum delivery window such as 1h30m or 24h." }, "nullable": true, "handle": "deliverWithin", "value": null }, { "description": "Whether to send in Mailgun test mode.", "jsonSchema": { "type": "boolean", "description": "Whether to send in Mailgun test mode." }, "nullable": true, "handle": "testMode", "value": null }, { "description": "Mailgun yes/no or boolean string option value.", "jsonSchema": { "type": "string", "enum": [ "yes", "no", "true", "false" ], "description": "Mailgun yes/no or boolean string option value." }, "nullable": true, "handle": "dkim", "value": null }, { "description": "Mailgun tracking option value.", "jsonSchema": { "type": "string", "enum": [ "yes", "no", "true", "false", "htmlonly" ], "description": "Mailgun tracking option value." }, "nullable": true, "handle": "tracking", "value": null }, { "description": "Mailgun tracking option value.", "jsonSchema": { "type": "string", "enum": [ "yes", "no", "true", "false", "htmlonly" ], "description": "Mailgun tracking option value." }, "nullable": true, "handle": "trackingClicks", "value": null }, { "description": "Mailgun yes/no or boolean string option value.", "jsonSchema": { "type": "string", "enum": [ "yes", "no", "true", "false" ], "description": "Mailgun yes/no or boolean string option value." }, "nullable": true, "handle": "trackingOpens", "value": null }, { "description": "Whether Mailgun must deliver only over TLS.", "jsonSchema": { "type": "boolean", "description": "Whether Mailgun must deliver only over TLS." }, "nullable": true, "handle": "requireTls", "value": null }, { "description": "Whether Mailgun should skip MX TLS certificate verification.", "jsonSchema": { "type": "boolean", "description": "Whether Mailgun should skip MX TLS certificate verification." }, "nullable": true, "handle": "skipVerification", "value": null }, { "description": "Dedicated sending IP address to use.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Dedicated sending IP address to use." }, "nullable": true, "handle": "sendingIp", "value": null }, { "description": "Dedicated IP pool ID to use.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Dedicated IP pool ID to use." }, "nullable": true, "handle": "sendingIpPool", "value": null } ], "outputs": [ { "description": "Mailgun message identifier.", "jsonSchema": { "type": [ "string", "null" ], "description": "Mailgun message identifier." }, "nullable": true, "handle": "id" }, { "description": "Mailgun status message.", "jsonSchema": { "type": [ "string", "null" ], "description": "Mailgun status message." }, "nullable": true, "handle": "message" }, { "description": "Object returned by Mailgun.", "jsonSchema": { "type": "object", "properties": {}, "additionalProperties": true, "description": "Object returned by Mailgun." }, "nullable": false, "handle": "raw" } ], "name": "Send failure email", "executor": { "kind": "connector", "action": "mailgun.send_email" } } } }, "edges": [ { "source": "n_c379ab43b51ea0d2", "target": "n_17765a563053d7b6" }, { "source": "n_17765a563053d7b6", "target": "n_fe9374cd346e7569" } ] } }, "modules": { "n_1639425f028e5d6c": { "name": "Prepare failure details", "imports": [], "source": "export default function prepare({workflow,execution,error}){if(typeof workflow?.name!=='string'||!workflow.name||typeof execution?.runId!=='string'||!execution.runId||typeof error?.message!=='string')throw Error('Missing failure details');const name=workflow.name.replace(/[\\r\\n]+/g,' '),v=x=>typeof x==='string'&&x?x:'not available';return{subject:'Workflow failure: '+name,body:`Workflow: ${workflow.name}\\nRun ID: ${execution.runId}\\nNode ID: ${v(error.nodeId)}\\nJob ID: ${v(error.jobId)}\\nPath: ${Array.isArray(error.path)?JSON.stringify(error.path):'not available'}\\nError code: ${v(error.code)}\\nError: ${error.message}`}}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }