{ "kind": "open-flow-workflow", "version": 1, "name": "Move GetResponse Contacts to a List", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_0d9e3f9663282177": { "name": "Choose destination list", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "targetCampaignId" } ] }, "n_30604bbb52f9dd94": { "inputs": { "campaignId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_0d9e3f9663282177", "output": "targetCampaignId" } ] } }, "name": "Read destination list", "kind": "task", "task": { "inputs": [ { "description": "A GetResponse resource identifier.", "jsonSchema": { "type": "string", "minLength": 1, "description": "A GetResponse resource identifier." }, "nullable": false, "handle": "campaignId" } ], "outputs": [ { "description": "A normalized GetResponse campaign, also known as a contact list.", "jsonSchema": { "type": "object", "properties": { "campaignId": { "type": "string", "minLength": 1, "description": "A GetResponse resource identifier." }, "name": { "type": "string", "description": "The campaign name." }, "languageCode": { "type": [ "string", "null" ], "description": "The campaign language code when returned by GetResponse." }, "isDefault": { "type": [ "boolean", "null" ], "description": "Whether this is the account's default campaign." }, "createdOn": { "type": [ "string", "null" ], "description": "The campaign creation timestamp when returned by GetResponse." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw campaign object returned by GetResponse." } }, "required": [ "campaignId", "name", "languageCode", "isDefault", "createdOn", "raw" ], "additionalProperties": false, "description": "A normalized GetResponse campaign, also known as a contact list." }, "nullable": false, "handle": "campaign" } ], "name": "Read destination list", "executor": { "kind": "connector", "action": "getresponse.get_campaign" } } }, "n_58829696ae5e44da": { "inputs": { "perPage": { "kind": "value", "value": 100 }, "page": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_aa8d0e9653533346", "output": "nextPage" } ] } }, "name": "List contacts", "kind": "task", "task": { "inputs": [ { "description": "Filter contacts by an exact address or partial email value.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Filter contacts by an exact address or partial email value." }, "nullable": true, "handle": "email", "value": null }, { "description": "Filter contacts by name.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Filter contacts by name." }, "nullable": true, "handle": "name", "value": null }, { "description": "A GetResponse resource identifier.", "jsonSchema": { "type": "string", "minLength": 1, "description": "A GetResponse resource identifier." }, "nullable": true, "handle": "campaignId", "value": null }, { "description": "Use exact matching for the email and name filters.", "jsonSchema": { "type": "boolean", "description": "Use exact matching for the email and name filters." }, "nullable": true, "handle": "exactMatch", "value": null }, { "description": "An ISO 8601 date or timestamp.", "jsonSchema": { "anyOf": [ { "type": "string", "format": "date", "description": "An ISO 8601 calendar date." }, { "type": "string", "format": "date-time", "description": "An ISO 8601 timestamp." } ], "description": "An ISO 8601 date or timestamp." }, "nullable": true, "handle": "createdFrom", "value": null }, { "description": "An ISO 8601 date or timestamp.", "jsonSchema": { "anyOf": [ { "type": "string", "format": "date", "description": "An ISO 8601 calendar date." }, { "type": "string", "format": "date-time", "description": "An ISO 8601 timestamp." } ], "description": "An ISO 8601 date or timestamp." }, "nullable": true, "handle": "createdTo", "value": null }, { "description": "An ISO 8601 date or timestamp.", "jsonSchema": { "anyOf": [ { "type": "string", "format": "date", "description": "An ISO 8601 calendar date." }, { "type": "string", "format": "date-time", "description": "An ISO 8601 timestamp." } ], "description": "An ISO 8601 date or timestamp." }, "nullable": true, "handle": "changedFrom", "value": null }, { "description": "An ISO 8601 date or timestamp.", "jsonSchema": { "anyOf": [ { "type": "string", "format": "date", "description": "An ISO 8601 calendar date." }, { "type": "string", "format": "date-time", "description": "An ISO 8601 timestamp." } ], "description": "An ISO 8601 date or timestamp." }, "nullable": true, "handle": "changedTo", "value": null }, { "description": "The contact field to sort by.", "jsonSchema": { "type": "string", "enum": [ "email", "name", "createdOn", "changedOn", "campaignId" ], "description": "The contact field to sort by." }, "nullable": true, "handle": "sortBy", "value": null }, { "description": "The sort direction.", "jsonSchema": { "type": "string", "enum": [ "ASC", "DESC" ], "description": "The sort direction." }, "nullable": true, "handle": "sortOrder", "value": null }, { "description": "The one-based result page to request.", "jsonSchema": { "type": "integer", "minimum": 1, "description": "The one-based result page to request." }, "nullable": true, "handle": "page", "value": null }, { "description": "The maximum number of results per page.", "jsonSchema": { "type": "integer", "minimum": 1, "maximum": 1000, "description": "The maximum number of results per page." }, "nullable": true, "handle": "perPage", "value": null } ], "outputs": [ { "description": "Contacts returned by GetResponse.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "contactId": { "type": "string", "minLength": 1, "description": "A GetResponse resource identifier." }, "email": { "type": "string", "format": "email", "description": "The contact email address." }, "name": { "type": [ "string", "null" ], "description": "The contact name when present." }, "campaign": { "type": [ "object", "null" ], "properties": { "campaignId": { "type": "string", "minLength": 1, "description": "A GetResponse resource identifier." }, "name": { "type": [ "string", "null" ], "description": "The campaign name when returned by GetResponse." } }, "required": [ "campaignId", "name" ], "additionalProperties": false, "description": "A GetResponse campaign reference." }, "origin": { "type": [ "string", "null" ], "description": "How the contact was added to GetResponse." }, "createdOn": { "type": [ "string", "null" ], "description": "The contact creation timestamp when returned by GetResponse." }, "changedOn": { "type": [ "string", "null" ], "description": "The latest contact change timestamp when returned by GetResponse." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw contact object returned by GetResponse." } }, "required": [ "contactId", "email", "name", "campaign", "origin", "createdOn", "changedOn", "raw" ], "additionalProperties": false, "description": "A normalized GetResponse contact." }, "description": "Contacts returned by GetResponse." }, "nullable": false, "handle": "contacts" }, { "description": "Pagination metadata returned by GetResponse.", "jsonSchema": { "type": "object", "properties": { "currentPage": { "type": [ "integer", "null" ], "description": "The current page reported by GetResponse." }, "totalPages": { "type": [ "integer", "null" ], "description": "The total number of result pages reported by GetResponse." }, "totalCount": { "type": [ "integer", "null" ], "description": "The total number of matching records reported by GetResponse." } }, "required": [ "currentPage", "totalPages", "totalCount" ], "additionalProperties": false, "description": "Pagination metadata returned by GetResponse." }, "nullable": false, "handle": "pagination" } ], "name": "List contacts", "executor": { "kind": "connector", "action": "getresponse.list_contacts" } } }, "n_aa8d0e9653533346": { "inputs": { "contacts": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_58829696ae5e44da", "output": "contacts" } ] }, "pagination": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_58829696ae5e44da", "output": "pagination" } ] }, "previousState": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_aa8d0e9653533346", "output": "state" } ] } }, "name": "Collect all contact pages", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "contactId": { "type": "string", "minLength": 1, "description": "A GetResponse resource identifier." }, "email": { "type": "string", "format": "email", "description": "The contact email address." }, "name": { "type": [ "string", "null" ], "description": "The contact name when present." }, "campaign": { "type": [ "object", "null" ], "properties": { "campaignId": { "type": "string", "minLength": 1, "description": "A GetResponse resource identifier." }, "name": { "type": [ "string", "null" ], "description": "The campaign name when returned by GetResponse." } }, "required": [ "campaignId", "name" ], "additionalProperties": false, "description": "A GetResponse campaign reference." }, "origin": { "type": [ "string", "null" ], "description": "How the contact was added to GetResponse." }, "createdOn": { "type": [ "string", "null" ], "description": "The contact creation timestamp when returned by GetResponse." }, "changedOn": { "type": [ "string", "null" ], "description": "The latest contact change timestamp when returned by GetResponse." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw contact object returned by GetResponse." } }, "required": [ "contactId", "email", "name", "campaign", "origin", "createdOn", "changedOn", "raw" ], "additionalProperties": false, "description": "A normalized GetResponse contact." }, "description": "Contacts returned by GetResponse." }, "nullable": false, "handle": "contacts" }, { "jsonSchema": { "type": "object", "properties": { "currentPage": { "type": [ "integer", "null" ], "description": "The current page reported by GetResponse." }, "totalPages": { "type": [ "integer", "null" ], "description": "The total number of result pages reported by GetResponse." }, "totalCount": { "type": [ "integer", "null" ], "description": "The total number of matching records reported by GetResponse." } }, "required": [ "currentPage", "totalPages", "totalCount" ], "additionalProperties": false, "description": "Pagination metadata returned by GetResponse." }, "nullable": false, "handle": "pagination" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previousState" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" }, { "jsonSchema": { "type": "integer", "minimum": 1 }, "nullable": false, "handle": "nextPage" } ], "name": "Collect all contact pages", "moduleId": "n_82a65732d30e538f", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_370573b829bdd153": { "inputs": {}, "name": "More pages?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "yes", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_aa8d0e9653533346", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_c6cd19be126acc0a": { "inputs": { "state": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_aa8d0e9653533346", "output": "state" } ] }, "campaign": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_30604bbb52f9dd94", "output": "campaign" } ] }, "targetCampaignId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_0d9e3f9663282177", "output": "targetCampaignId" } ] } }, "name": "Select contacts to move", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "object", "properties": { "campaignId": { "type": "string", "minLength": 1, "description": "A GetResponse resource identifier." }, "name": { "type": "string", "description": "The campaign name." }, "languageCode": { "type": [ "string", "null" ], "description": "The campaign language code when returned by GetResponse." }, "isDefault": { "type": [ "boolean", "null" ], "description": "Whether this is the account's default campaign." }, "createdOn": { "type": [ "string", "null" ], "description": "The campaign creation timestamp when returned by GetResponse." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw campaign object returned by GetResponse." } }, "required": [ "campaignId", "name", "languageCode", "isDefault", "createdOn", "raw" ], "additionalProperties": false, "description": "A normalized GetResponse campaign, also known as a contact list." }, "nullable": false, "handle": "campaign" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "targetCampaignId" } ], "outputs": [ { "jsonSchema": { "type": "array", "items": { "type": "string" } }, "nullable": false, "handle": "ids" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "targetCampaignId" } ], "name": "Select contacts to move", "moduleId": "n_dbb8731a0ac51163", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_3855d3b314c8c1d1": { "inputs": { "ids": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c6cd19be126acc0a", "output": "ids" } ] }, "targetCampaignId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c6cd19be126acc0a", "output": "targetCampaignId" } ] }, "previousState": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3855d3b314c8c1d1", "output": "state" } ] } }, "name": "Prepare next contact", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "string" } }, "nullable": false, "handle": "ids" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "targetCampaignId" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previousState" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "contactId" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "campaignId" } ], "name": "Prepare next contact", "moduleId": "n_d5c4c22a3fea1571", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_6008ac1ca442a660": { "inputs": {}, "name": "More contacts?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "yes", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_3855d3b314c8c1d1", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_2481ed8c3136213d": { "inputs": { "contactId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3855d3b314c8c1d1", "output": "contactId" } ] }, "campaignId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3855d3b314c8c1d1", "output": "campaignId" } ] } }, "name": "Move contact", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "contactId" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "campaignId" } ], "outputs": [ { "jsonSchema": { "type": "object", "properties": { "contactId": { "type": "string", "minLength": 1, "description": "A GetResponse resource identifier." }, "email": { "type": "string", "format": "email", "description": "The contact email address." }, "name": { "type": [ "string", "null" ], "description": "The contact name when present." }, "campaign": { "type": [ "object", "null" ], "properties": { "campaignId": { "type": "string", "minLength": 1, "description": "A GetResponse resource identifier." }, "name": { "type": [ "string", "null" ], "description": "The campaign name when returned by GetResponse." } }, "required": [ "campaignId", "name" ], "additionalProperties": false, "description": "A GetResponse campaign reference." }, "origin": { "type": [ "string", "null" ], "description": "How the contact was added to GetResponse." }, "createdOn": { "type": [ "string", "null" ], "description": "The contact creation timestamp when returned by GetResponse." }, "changedOn": { "type": [ "string", "null" ], "description": "The latest contact change timestamp when returned by GetResponse." }, "raw": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The raw contact object returned by GetResponse." } }, "required": [ "contactId", "email", "name", "campaign", "origin", "createdOn", "changedOn", "raw" ], "additionalProperties": false, "description": "A normalized GetResponse contact." }, "nullable": false, "handle": "contact" } ], "name": "Move contact", "moduleId": "n_2b516d0d63c0dd60", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [ { "action": "getresponse.update_contact" } ] } ] } } }, "edges": [ { "source": "n_0d9e3f9663282177", "target": "n_30604bbb52f9dd94" }, { "source": "n_30604bbb52f9dd94", "target": "n_58829696ae5e44da" }, { "source": "n_58829696ae5e44da", "target": "n_aa8d0e9653533346" }, { "source": "n_aa8d0e9653533346", "target": "n_370573b829bdd153" }, { "source": "n_370573b829bdd153", "target": "n_58829696ae5e44da", "sourceHandle": "yes" }, { "source": "n_370573b829bdd153", "target": "n_c6cd19be126acc0a", "sourceHandle": "otherwise" }, { "source": "n_c6cd19be126acc0a", "target": "n_3855d3b314c8c1d1" }, { "source": "n_3855d3b314c8c1d1", "target": "n_6008ac1ca442a660" }, { "source": "n_6008ac1ca442a660", "target": "n_2481ed8c3136213d", "sourceHandle": "yes" }, { "source": "n_2481ed8c3136213d", "target": "n_3855d3b314c8c1d1" } ] } }, "modules": { "n_82a65732d30e538f": { "name": "Collect all contact pages", "imports": [], "source": "export default function collect({contacts,pagination,previousState}) {const s=previousState??{records:[],page:0,totalPages:null,totalCount:null};if(!Array.isArray(contacts)||!Array.isArray(s.records)||!pagination)throw Error('Invalid contact page');const {currentPage,totalPages,totalCount}=pagination;if(!Number.isInteger(currentPage)||!Number.isInteger(totalPages)||!Number.isInteger(totalCount)||currentPage!==s.page+1||totalPages<0||totalCount<0||(s.totalPages!==null&&(s.totalPages!==totalPages||s.totalCount!==totalCount))||(totalPages===0&&(currentPage!==1||contacts.length!==0||totalCount!==0))||(totalPages>0&¤tPage>totalPages))throw Error('Inconsistent pagination');const records=[...s.records,...contacts];if(records.length>totalCount||(!contacts.length&¤tPageids.length)throw Error('Invalid update position');return{state:{index:i+1},more:i