{ "kind": "open-flow-workflow", "version": 1, "name": "Subscribe and Send a Sendy Campaign", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_6fdc5e72e07f1258": { "name": "Run campaign", "kind": "start", "inputDefs": [] }, "n_9261c2adcda50a21": { "inputs": { "url": { "kind": "value", "value": "https://YOUR_SENDY_HOST/subscribe" }, "body": { "kind": "value", "value": "api_key=YOUR_KEY&name=YOUR_NAME&email=YOUR_EMAIL&list=YOUR_LIST_ID&boolean=true" }, "header.Content-Type": { "kind": "value", "value": "application/x-www-form-urlencoded" } }, "name": "Subscribe to list", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "header.Content-Type" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "body" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" } ], "name": "Subscribe to list", "executor": { "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [ "Content-Type" ] }, "bodyFormat": "text", "authentication": { "type": "none" }, "responseFormat": "text", "statusPolicy": "success", "kind": "http-request" } } }, "n_4bfae3673ae36cda": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_9261c2adcda50a21", "output": "body" } ] } }, "name": "Confirm subscription", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "body" } ], "outputs": [ { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "ok" } ], "name": "Confirm subscription", "moduleId": "n_a86d3557b3d0176c", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_e628fa978d55aebb": { "inputs": { "url": { "kind": "value", "value": "https://YOUR_SENDY_HOST/api/campaigns/create.php" }, "body": { "kind": "value", "value": "api_key=YOUR_KEY&from_name=YOUR_NAME&from_email=YOUR_EMAIL&reply_to=YOUR_REPLY_TO&title=YOUR_TITLE&subject=YOUR_SUBJECT&html_text=YOUR_HTML&list_ids=YOUR_LIST_ID&send_campaign=1&boolean=true" }, "header.Content-Type": { "kind": "value", "value": "application/x-www-form-urlencoded" } }, "name": "Create and send campaign", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "header.Content-Type" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "body" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" } ], "name": "Create and send campaign", "executor": { "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [ "Content-Type" ] }, "bodyFormat": "text", "authentication": { "type": "none" }, "responseFormat": "text", "statusPolicy": "success", "kind": "http-request" } } }, "n_4ac8aadcbee74481": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_e628fa978d55aebb", "output": "body" } ] } }, "name": "Confirm campaign", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "body" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "message" } ], "name": "Confirm campaign", "moduleId": "n_71823e30f48a6d23", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_f9fb51495419c458": { "name": "Campaign result", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "message" } ], "outputMappings": { "message": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4ac8aadcbee74481", "output": "message" } ] } } } }, "edges": [ { "source": "n_6fdc5e72e07f1258", "target": "n_9261c2adcda50a21" }, { "source": "n_9261c2adcda50a21", "target": "n_4bfae3673ae36cda" }, { "source": "n_4bfae3673ae36cda", "target": "n_e628fa978d55aebb" }, { "source": "n_e628fa978d55aebb", "target": "n_4ac8aadcbee74481" }, { "source": "n_4ac8aadcbee74481", "target": "n_f9fb51495419c458" } ] } }, "modules": { "n_a86d3557b3d0176c": { "name": "Confirm subscription", "imports": [], "source": "export default function({body}){if(body!=='1'&&body!=='true')throw Error('Sendy did not confirm the subscription');return {ok:true}}\n" }, "n_71823e30f48a6d23": { "name": "Confirm campaign", "imports": [], "source": "export default function({body}){if(body!=='Campaign created'&&body!=='Campaign created and now sending')throw Error('Sendy did not confirm campaign creation');return {message:body}}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }