{ "kind": "open-flow-workflow", "version": 1, "name": "Zulip Private Message Sender", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_a4ec8b2edcc37f36": { "name": "Enter private message", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "array", "minItems": 1, "items": { "type": "string", "format": "email" } }, "nullable": false, "handle": "recipients" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "content" } ] }, "n_f6951afc1d626e65": { "inputs": { "recipients": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a4ec8b2edcc37f36", "output": "recipients" } ] }, "content": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a4ec8b2edcc37f36", "output": "content" } ] } }, "name": "Prepare Zulip private message", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "minItems": 1, "items": { "type": "string", "format": "email" } }, "nullable": false, "handle": "recipients" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "content" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": { "anyOf": [ { "type": [ "string", "number", "boolean" ] }, { "type": "array", "items": { "type": [ "string", "number", "boolean" ] } } ] } }, "nullable": false, "handle": "body" } ], "name": "Prepare Zulip private message", "moduleId": "n_64fa85b038bb2d1b", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_2d6b6d75bc5a7c61": { "inputs": { "url": { "kind": "value", "value": "https://YOUR_ORGANIZATION.zulipchat.com/api/v1/messages" }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f6951afc1d626e65", "output": "body" } ] }, "auth.username": { "kind": "unset" }, "auth.password": { "kind": "unset" } }, "name": "Send Zulip private message", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "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.username" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "auth.password" } ], "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 Zulip private message", "executor": { "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "form", "authentication": { "type": "basic" }, "responseFormat": "json", "statusPolicy": "success", "kind": "http-request" } } }, "n_20dd3975bc061f24": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2d6b6d75bc5a7c61", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2d6b6d75bc5a7c61", "output": "statusCode" } ] } }, "name": "Confirm Zulip message", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "message" } ], "name": "Confirm Zulip message", "moduleId": "n_a60cfd895b977e34", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_80a7b22f1a7a7b14": { "name": "Sent Zulip message", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "message" } ], "outputMappings": { "message": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_20dd3975bc061f24", "output": "message" } ] } } } }, "edges": [ { "source": "n_a4ec8b2edcc37f36", "target": "n_f6951afc1d626e65" }, { "source": "n_f6951afc1d626e65", "target": "n_2d6b6d75bc5a7c61" }, { "source": "n_2d6b6d75bc5a7c61", "target": "n_20dd3975bc061f24" }, { "source": "n_20dd3975bc061f24", "target": "n_80a7b22f1a7a7b14" } ] } }, "modules": { "n_64fa85b038bb2d1b": { "name": "Prepare Zulip private message", "imports": [], "source": "export default function ({ recipients, content }) {\n if (!Array.isArray(recipients) || recipients.length === 0 || recipients.some((email) => typeof email !== 'string' || !/^[^\\s,@]+@[^\\s,@]+\\.[^\\s,@]+$/.test(email))) throw new Error('Enter one or more Zulip API recipient email addresses');\n if (typeof content !== 'string' || content.trim().length === 0) throw new Error('Enter message content');\n return { body: { type: 'private', to: JSON.stringify(recipients), content } };\n}\n" }, "n_a60cfd895b977e34": { "name": "Confirm Zulip message", "imports": [], "source": "function readZulipMessage(body) {\n if (!body || typeof body !== 'object' || Array.isArray(body) || body.result !== 'success' || !Number.isSafeInteger(body.id) || body.id < 1) throw new Error('Zulip did not confirm a sent message');\n return body;\n}\nexport default function ({ body, statusCode }) {\n if (statusCode !== 200) throw new Error('Zulip did not return a successful response');\n return { message: readZulipMessage(body) };\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }