{ "kind": "open-flow-workflow", "version": 1, "name": "Send an SMS with seven", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_aaca821c40c72cad": { "name": "Enter the SMS details", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "to" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "from" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "message" } ] }, "n_b23c5cb0f0af66b7": { "inputs": { "to": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_aaca821c40c72cad", "output": "to" } ] }, "from": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_aaca821c40c72cad", "output": "from" } ] }, "message": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_aaca821c40c72cad", "output": "message" } ] } }, "name": "Prepare the SMS", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "to" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "from" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "message" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": { "anyOf": [ { "type": [ "string", "number", "boolean" ] }, { "type": "array", "items": { "type": [ "string", "number", "boolean" ] } } ] } }, "nullable": false, "handle": "body" } ], "name": "Prepare the SMS", "moduleId": "n_059480ba2f946520", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_d6e5f72fc57e58b5": { "inputs": { "url": { "kind": "value", "value": "https://gateway.seven.io/api/sms" }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b23c5cb0f0af66b7", "output": "body" } ] }, "header.Accept": { "kind": "value", "value": "application/json" }, "auth.token": { "kind": "unset" } }, "name": "Send the SMS", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "header.Accept" }, { "jsonSchema": { "type": "object", "additionalProperties": { "anyOf": [ { "type": [ "string", "number", "boolean" ] }, { "type": "array", "items": { "type": [ "string", "number", "boolean" ] } } ] } }, "nullable": false, "handle": "body" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "auth.token" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" } ], "name": "Send the SMS", "executor": { "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [ "Accept" ] }, "bodyFormat": "form", "authentication": { "type": "apiKey", "name": "X-Api-Key", "in": "header" }, "responseFormat": "json", "statusPolicy": "success", "kind": "http-request" } } }, "n_90a5596cd20c3857": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d6e5f72fc57e58b5", "output": "body" } ] } }, "name": "Check the response", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "response" } ], "name": "Check the response", "moduleId": "n_03b3dea3e49b274b", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_fe51e26070c4b069": { "name": "SMS response", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "response" } ], "outputMappings": { "response": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_90a5596cd20c3857", "output": "response" } ] } } } }, "edges": [ { "source": "n_aaca821c40c72cad", "target": "n_b23c5cb0f0af66b7" }, { "source": "n_b23c5cb0f0af66b7", "target": "n_d6e5f72fc57e58b5" }, { "source": "n_d6e5f72fc57e58b5", "target": "n_90a5596cd20c3857" }, { "source": "n_90a5596cd20c3857", "target": "n_fe51e26070c4b069" } ] } }, "modules": { "n_059480ba2f946520": { "name": "Prepare the SMS", "imports": [], "source": "export default function prepare({to,from,message}){return {body:{to,text:message,from:from??''}};}\n" }, "n_03b3dea3e49b274b": { "name": "Check the response", "imports": [], "source": "export default function check({body}){if(!body||typeof body!=='object'||body.success!=='100')throw Error('seven did not accept the complete SMS request; inspect recipient statuses before retrying');return{response:body};}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }