{ "kind": "open-flow-workflow", "version": 1, "name": "Search Sheet Contacts with Icypeas", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_f57c6e1dafd2a7b5": { "name": "Run the search", "kind": "start", "inputDefs": [] }, "n_355850712a140530": { "inputs": { "spreadsheetId": { "kind": "value", "value": "YOUR_SPREADSHEET_ID" }, "range": { "kind": "value", "value": "'Sheet1'!A:Z" }, "majorDimension": { "kind": "value", "value": "ROWS" }, "valueRenderOption": { "kind": "value", "value": "UNFORMATTED_VALUE" } }, "name": "Read contact rows", "kind": "task", "task": { "inputs": [ { "description": "The spreadsheet ID.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The spreadsheet ID." }, "nullable": true, "handle": "spreadsheetId", "value": null }, { "description": "The A1 notation of the range to retrieve.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The A1 notation of the range to retrieve." }, "nullable": false, "handle": "range" }, { "description": "The major dimension for the returned values.", "jsonSchema": { "type": "string", "enum": [ "DIMENSION_UNSPECIFIED", "ROWS", "COLUMNS" ], "description": "The major dimension for the returned values." }, "nullable": true, "handle": "majorDimension", "value": null }, { "description": "How values should be rendered in the output.", "jsonSchema": { "type": "string", "enum": [ "FORMATTED_VALUE", "UNFORMATTED_VALUE", "FORMULA" ], "description": "How values should be rendered in the output." }, "nullable": true, "handle": "valueRenderOption", "value": null }, { "description": "How dates and times should be rendered in the output.", "jsonSchema": { "type": "string", "enum": [ "SERIAL_NUMBER", "FORMATTED_STRING" ], "description": "How dates and times should be rendered in the output." }, "nullable": true, "handle": "dateTimeRenderOption", "value": null } ], "outputs": [ { "description": "The A1 notation of the range.", "jsonSchema": { "type": "string", "description": "The A1 notation of the range." }, "nullable": false, "handle": "range" }, { "description": "The major dimension of the values (ROWS or COLUMNS).", "jsonSchema": { "type": "string", "description": "The major dimension of the values (ROWS or COLUMNS)." }, "nullable": false, "handle": "majorDimension" }, { "description": "The data values in the range.", "jsonSchema": { "type": "array", "items": { "type": "array", "items": { "anyOf": [ { "type": "string", "description": "A union variant." }, { "type": "number", "description": "A union variant." }, { "type": "boolean", "description": "A union variant." }, { "const": null, "description": "A union variant." } ], "description": "The cell value schema." }, "description": "An array item." }, "description": "The data values in the range." }, "nullable": false, "handle": "values" } ], "name": "Read contact rows", "executor": { "kind": "connector", "action": "googlesheets.values_get" } } }, "n_38ebf7beb6c72de0": { "inputs": { "values": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_355850712a140530", "output": "values" } ] } }, "name": "Map every contact", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "array", "items": { "anyOf": [ { "type": "string", "description": "A union variant." }, { "type": "number", "description": "A union variant." }, { "type": "boolean", "description": "A union variant." }, { "const": null, "description": "A union variant." } ], "description": "The cell value schema." }, "description": "An array item." }, "description": "The data values in the range." }, "nullable": false, "handle": "values" } ], "outputs": [ { "jsonSchema": { "type": "array", "items": { "type": "array", "items": { "type": "string" } } }, "nullable": false, "handle": "rows" } ], "name": "Map every contact", "moduleId": "n_1feaa9988d151af6", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_20fa21a421930eec": { "inputs": { "rows": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_38ebf7beb6c72de0", "output": "rows" } ] }, "previousState": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_20fa21a421930eec", "output": "state" } ] }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_e52fdc65d780a3be", "output": "body" } ] } }, "name": "Prepare next batch", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "array", "items": { "type": "string" } } }, "nullable": false, "handle": "rows" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previousState" }, { "jsonSchema": {}, "nullable": true, "handle": "body" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" }, { "jsonSchema": { "type": "array", "items": { "type": "string" } }, "nullable": false, "handle": "files" } ], "name": "Prepare next batch", "moduleId": "n_b0d4fad5c4a60a0b", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_b269984cbf965990": { "inputs": {}, "name": "Any remaining contacts?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "yes", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_20fa21a421930eec", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_e52fdc65d780a3be": { "inputs": { "url": { "kind": "value", "value": "https://app.icypeas.com/api/bulk-search" }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_20fa21a421930eec", "output": "body" } ] }, "auth.token": { "kind": "unset" } }, "name": "Submit a search batch", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "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": "Submit a search batch", "executor": { "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "json", "authentication": { "type": "apiKey", "name": "Authorization", "in": "header" }, "responseFormat": "json", "statusPolicy": "success", "kind": "http-request" } } }, "n_07f79fe6d773104e": { "inputs": {}, "name": "Wait between requests", "kind": "wait", "inputDefinitions": [], "prompt": "Wait between requests", "autoContinue": { "kind": "after", "durationMs": 1000 } }, "n_4202b7c6aaebc73d": { "name": "Submitted search IDs", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "array", "items": { "type": "string" } }, "nullable": false, "handle": "files" } ], "outputMappings": { "files": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_20fa21a421930eec", "output": "files" } ] } } } }, "edges": [ { "source": "n_f57c6e1dafd2a7b5", "target": "n_355850712a140530" }, { "source": "n_355850712a140530", "target": "n_38ebf7beb6c72de0" }, { "source": "n_38ebf7beb6c72de0", "target": "n_20fa21a421930eec" }, { "source": "n_20fa21a421930eec", "target": "n_b269984cbf965990" }, { "source": "n_b269984cbf965990", "target": "n_e52fdc65d780a3be", "sourceHandle": "yes" }, { "source": "n_e52fdc65d780a3be", "target": "n_07f79fe6d773104e" }, { "source": "n_07f79fe6d773104e", "target": "n_20fa21a421930eec", "sourceHandle": "continue" }, { "source": "n_b269984cbf965990", "target": "n_4202b7c6aaebc73d", "sourceHandle": "otherwise" } ] } }, "modules": { "n_1feaa9988d151af6": { "name": "Map every contact", "imports": [], "source": "export default function map({values}){if(!Array.isArray(values))throw Error('Expected sheet rows');if(!values.length)return{rows:[]};const headers=values[0],indexes=['firstname','lastname','company'].map(x=>headers.indexOf(x));if(indexes.some(i=>i<0))throw Error('Expected firstname, lastname, company headers');const rows=[];for(const cells of values.slice(1)){if(!cells.some(x=>x!==''&&x!=null))continue;const r=indexes.map(i=>String(cells[i]??''));if((!r[0]&&!r[1])||!r[2])throw Error('Each row needs a first or last name and company');rows.push(r)}return{rows}}\n" }, "n_b0d4fad5c4a60a0b": { "name": "Prepare next batch", "imports": [], "source": "export default function next({rows,previousState,body}){if(!Array.isArray(rows))throw Error('Expected complete rows');let state;if(previousState==null)state={offset:0,files:[]};else{if(!body||body.success!==true||typeof body.file!=='string'||!body.file)throw Error('Icypeas did not confirm batch; it may have been submitted');state={offset:previousState.offset+previousState.size,files:[...previousState.files,body.file]}}const batch=rows.slice(state.offset,state.offset+5000),more=batch.length>0;state.size=batch.length;return{state,more,body:{name:'Test',task:'email-search',data:batch},files:state.files}}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }