{ "kind": "open-flow-workflow", "version": 1, "name": "Mailchimp Member Creator", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_25b73f7cab31e086": { "name": "Enter audience member details", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "listId" }, { "jsonSchema": { "type": "string", "format": "email", "description": "Subscriber email address used by Mailchimp to derive the subscriber hash." }, "nullable": false, "handle": "email" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "firstName" } ] }, "n_c399d30312b40680": { "inputs": { "listId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_25b73f7cab31e086", "output": "listId" } ] }, "email": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_25b73f7cab31e086", "output": "email" } ] }, "firstName": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_25b73f7cab31e086", "output": "firstName" } ] } }, "name": "Prepare subscribed member", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "listId" }, { "jsonSchema": { "type": "string", "format": "email", "description": "Subscriber email address used by Mailchimp to derive the subscriber hash." }, "nullable": false, "handle": "email" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "firstName" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" } ], "name": "Prepare subscribed member", "moduleId": "n_12cefb600bf5ef25", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_ddf824767a3d3f9c": { "inputs": { "endpoint": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c399d30312b40680", "output": "endpoint" } ] }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c399d30312b40680", "output": "body" } ] } }, "name": "Add Mailchimp audience member", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" }, { "jsonSchema": {}, "nullable": true, "handle": "body" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" }, { "jsonSchema": { "const": "base64" }, "nullable": true, "handle": "bodyEncoding" } ], "name": "Add Mailchimp audience member", "executor": { "providerId": "mailchimp", "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "json", "kind": "connector-proxy" } } }, "n_235a356d573c99e0": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_ddf824767a3d3f9c", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_ddf824767a3d3f9c", "output": "statusCode" } ] }, "bodyEncoding": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_ddf824767a3d3f9c", "output": "bodyEncoding" } ] } }, "name": "Read created member", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "const": "base64" }, "nullable": true, "handle": "bodyEncoding" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "member" } ], "name": "Read created member", "moduleId": "n_827db72724c688e6", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_20a12caf9f00f5bd": { "name": "Created audience member", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "member" } ], "outputMappings": { "member": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_235a356d573c99e0", "output": "member" } ] } } } }, "edges": [ { "source": "n_25b73f7cab31e086", "target": "n_c399d30312b40680" }, { "source": "n_c399d30312b40680", "target": "n_ddf824767a3d3f9c" }, { "source": "n_ddf824767a3d3f9c", "target": "n_235a356d573c99e0" }, { "source": "n_235a356d573c99e0", "target": "n_20a12caf9f00f5bd" } ] } }, "modules": { "n_12cefb600bf5ef25": { "name": "Prepare subscribed member", "imports": [], "source": "export default function memberRequest({ listId, email, firstName }) {\n if (typeof listId !== 'string' || !listId.trim()) throw new Error('Audience ID is required');\n if (typeof email !== 'string' || !email.trim()) throw new Error('Email is required');\n if (typeof firstName !== 'string' || !firstName.trim()) throw new Error('First name is required');\n return { endpoint: '/lists/' + encodeURIComponent(listId) + '/members', body: { email_address: email, status: 'subscribed', merge_fields: { FNAME: firstName } } };\n}\n" }, "n_827db72724c688e6": { "name": "Read created member", "imports": [], "source": "export default function memberResult({ body, statusCode, bodyEncoding }) {\n if (statusCode !== 200 || bodyEncoding) throw new Error('Mailchimp did not return a completed member result (HTTP ' + statusCode + ')');\n if (!body || typeof body !== 'object' || Array.isArray(body) || typeof body.id !== 'string' || !body.id || typeof body.email_address !== 'string' || typeof body.status !== 'string') throw new Error('Mailchimp returned an unexpected member response');\n return { member: body };\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }