{ "kind": "open-flow-workflow", "version": 1, "name": "Get Five Zoho CRM Accounts", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_943857f7f1335b79": { "name": "Read CRM accounts", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "domain" } ] }, "n_7bdde00f6a2c7aea": { "inputs": { "domain": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_943857f7f1335b79", "output": "domain" } ] }, "state": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3d43decfad8e0b13", "output": "state" } ] } }, "name": "Prepare the next page", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "domain" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "state" } ], "outputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "url" } ], "name": "Prepare the next page", "moduleId": "n_64ec0bf7fbb4c0f1", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_2f5e207d6337ce8f": { "inputs": { "url": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_7bdde00f6a2c7aea", "output": "url" } ] }, "auth.token": { "kind": "unset" } }, "name": "Read account page", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "auth.token" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" } ], "name": "Read account page", "executor": { "method": "GET", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "none", "authentication": { "type": "apiKey", "name": "Authorization", "in": "header" }, "responseFormat": "json", "statusPolicy": "success", "kind": "http-request" } } }, "n_3d43decfad8e0b13": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2f5e207d6337ce8f", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2f5e207d6337ce8f", "output": "statusCode" } ] }, "previousState": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3d43decfad8e0b13", "output": "state" } ] } }, "name": "Collect the first five", "kind": "task", "task": { "inputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "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" } ], "name": "Collect the first five", "moduleId": "n_44a6dfcf59337dfa", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_b9549fc6e62cb38f": { "inputs": {}, "name": "More accounts?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "more", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_3d43decfad8e0b13", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_fed527a264edc84a": { "name": "Account results", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" } ], "outputMappings": { "state": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3d43decfad8e0b13", "output": "state" } ] } } } }, "edges": [ { "source": "n_943857f7f1335b79", "target": "n_7bdde00f6a2c7aea" }, { "source": "n_7bdde00f6a2c7aea", "target": "n_2f5e207d6337ce8f" }, { "source": "n_2f5e207d6337ce8f", "target": "n_3d43decfad8e0b13" }, { "source": "n_3d43decfad8e0b13", "target": "n_b9549fc6e62cb38f" }, { "source": "n_b9549fc6e62cb38f", "target": "n_7bdde00f6a2c7aea", "sourceHandle": "more" }, { "source": "n_b9549fc6e62cb38f", "target": "n_fed527a264edc84a", "sourceHandle": "otherwise" } ] } }, "modules": { "n_64ec0bf7fbb4c0f1": { "name": "Prepare the next page", "imports": [], "source": "export default function prepare({domain,state}){const allowed=['https://www.zohoapis.com','https://www.zohoapis.eu','https://www.zohoapis.in','https://www.zohoapis.com.au','https://www.zohoapis.com.cn','https://www.zohoapis.jp','https://www.zohoapis.ca','https://www.zohoapis.sa'];if(!allowed.includes(domain))throw Error('Configure a supported Zoho API domain');const page=(state?.page??0)+1;return{url:`${domain}/crm/v2/accounts?per_page=200&page=${page}`}}\n" }, "n_44a6dfcf59337dfa": { "name": "Collect the first five", "imports": [], "source": "export default function collect({body,statusCode,previousState}){const state=previousState??{page:0,records:[]};if(statusCode===204)return{state:{page:state.page+1,records:state.records},more:false};if(statusCode!==200||!body||body.data?.[0]?.status==='error'||!Array.isArray(body.data)||!body.info||typeof body.info.more_records!=='boolean')throw Error('Invalid Zoho response');return{state:{page:state.page+1,records:[...state.records,...body.data].slice(0,5)},more:body.info.more_records}}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }