{ "kind": "open-flow-workflow", "version": 1, "name": "Save MailerLite Classic Group Subscribers to Airtable", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_02d739a05fe507e3": { "name": "Receive MailerLite Classic events", "kind": "webhook", "bodyFields": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "events" } ], "method": "POST", "options": {} }, "n_980c5b886f66497f": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_02d739a05fe507e3", "output": "body" } ] }, "previous": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_980c5b886f66497f", "output": "state" } ] } }, "name": "Prepare the next subscriber", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previous" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "fields": { "type": "object", "additionalProperties": { "description": "A record value." }, "description": "Field values for the new Airtable record." } }, "required": [ "fields" ], "additionalProperties": false, "description": "Record payload used when creating Airtable records." }, "minItems": 1, "maxItems": 10, "description": "Records to create in the Airtable table." }, "nullable": false, "handle": "records" } ], "name": "Prepare the next subscriber", "moduleId": "n_feee4add70a1bf77", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_35e317654bc9949e": { "inputs": {}, "name": "More group events?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "more", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_980c5b886f66497f", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_ab14d10cafc6eccf": { "inputs": { "baseId": { "kind": "value", "value": "YOUR_AIRTABLE_BASE_ID" }, "tableIdOrName": { "kind": "value", "value": "Data" }, "records": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_980c5b886f66497f", "output": "records" } ] } }, "name": "Save the subscriber", "kind": "task", "task": { "inputs": [ { "description": "Base ID in the format appXXXXXXXXXXXXXX.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Base ID in the format appXXXXXXXXXXXXXX." }, "nullable": false, "handle": "baseId" }, { "description": "Table ID or table name accepted by the Airtable path parameter.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Table ID or table name accepted by the Airtable path parameter." }, "nullable": false, "handle": "tableIdOrName" }, { "description": "Records to create in the Airtable table.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "fields": { "type": "object", "additionalProperties": { "description": "A record value." }, "description": "Field values for the new Airtable record." } }, "required": [ "fields" ], "additionalProperties": false, "description": "Record payload used when creating Airtable records." }, "minItems": 1, "maxItems": 10, "description": "Records to create in the Airtable table." }, "nullable": false, "handle": "records" }, { "description": "Whether Airtable should coerce incoming values to compatible field types.", "jsonSchema": { "type": "boolean", "description": "Whether Airtable should coerce incoming values to compatible field types." }, "nullable": true, "handle": "typecast", "value": null }, { "description": "Whether Airtable should return field IDs instead of field names in record objects.", "jsonSchema": { "type": "boolean", "description": "Whether Airtable should return field IDs instead of field names in record objects." }, "nullable": true, "handle": "returnFieldsByFieldId", "value": null } ], "outputs": [ { "description": "Records created by Airtable.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Record ID." }, "createdTime": { "type": "string", "description": "Record creation timestamp returned by Airtable." }, "fields": { "type": "object", "additionalProperties": { "description": "A record value." }, "description": "Record fields keyed by field name or field ID." }, "commentCount": { "type": "integer", "description": "Comment count returned by Airtable when enabled on the endpoint." } }, "required": [ "id", "fields" ], "additionalProperties": true, "description": "Airtable record." }, "description": "Records created by Airtable." }, "nullable": false, "handle": "records" } ], "name": "Save the subscriber", "executor": { "kind": "connector", "action": "airtable.create_records" } } } }, "edges": [ { "source": "n_02d739a05fe507e3", "target": "n_980c5b886f66497f" }, { "source": "n_980c5b886f66497f", "target": "n_35e317654bc9949e" }, { "source": "n_35e317654bc9949e", "target": "n_ab14d10cafc6eccf", "sourceHandle": "more" }, { "source": "n_ab14d10cafc6eccf", "target": "n_980c5b886f66497f" } ] } }, "modules": { "n_feee4add70a1bf77": { "name": "Prepare the next subscriber", "imports": [], "source": "export default function next({body,previous}){const events=body?.events;if(!Array.isArray(events))throw Error('Expected MailerLite Classic events array');let index=previous?.index??0;if(!Number.isSafeInteger(index)||index<0)throw Error('Invalid event position');while(index