{ "kind": "open-flow-workflow", "version": 1, "name": "Send an SMS with MessageBird", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_20feb00764119abf": { "name": "Enter the SMS details", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "recipients" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "originator" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "message" } ] }, "n_b864aa908daaa2dd": { "inputs": { "recipients": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_20feb00764119abf", "output": "recipients" } ] }, "originator": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_20feb00764119abf", "output": "originator" } ] }, "message": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_20feb00764119abf", "output": "message" } ] } }, "name": "Prepare the SMS", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "recipients" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "originator" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "message" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" } ], "name": "Prepare the SMS", "moduleId": "n_dd0b034684325e23", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_61b308ac28883dc8": { "inputs": { "url": { "kind": "value", "value": "https://rest.messagebird.com/messages" }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b864aa908daaa2dd", "output": "body" } ] }, "auth.token": { "kind": "unset" } }, "name": "Send the SMS", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": {}, "nullable": true, "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": [] }, "bodyFormat": "json", "authentication": { "type": "apiKey", "name": "Authorization", "in": "header" }, "responseFormat": "json", "statusPolicy": "success", "kind": "http-request" } } }, "n_7bbb0da15dc01371": { "name": "Message response", "kind": "outputs", "outputDefs": [ { "jsonSchema": {}, "nullable": true, "handle": "response" } ], "outputMappings": { "response": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_61b308ac28883dc8", "output": "body" } ] } } } }, "edges": [ { "source": "n_20feb00764119abf", "target": "n_b864aa908daaa2dd" }, { "source": "n_b864aa908daaa2dd", "target": "n_61b308ac28883dc8" }, { "source": "n_61b308ac28883dc8", "target": "n_7bbb0da15dc01371" } ] } }, "modules": { "n_dd0b034684325e23": { "name": "Prepare the SMS", "imports": [], "source": "export default function prepare({recipients,originator,message}){const parts=recipients.split(',').map(x=>x.trim());if(!parts.length||parts.length>50||parts.some(x=>!/^\\+?\\d{1,15}$/.test(x)))throw Error('Enter 1 to 50 recipient numbers with country codes');return {body:{recipients:parts.map(x=>parseInt(x,10)),originator,body:message}};}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }