{ "kind": "open-flow-workflow", "version": 1, "name": "Save Google Maps Business Leads to Sheets", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_66bdc4f3dc6dc751": { "name": "Run the search", "kind": "start", "inputDefs": [] }, "n_f87acc9341b9ae72": { "inputs": { "query": { "kind": "value", "value": "coffee shops in New York" } }, "name": "Set the search query", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "query" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" } ], "name": "Set the search query", "moduleId": "n_d21d375ea8f0cf89", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_df844678b2c07259": { "inputs": { "endpoint": { "kind": "value", "value": "/api/v1/search-maps" }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f87acc9341b9ae72", "output": "body" } ] } }, "name": "Search Maps", "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": "Search Maps", "executor": { "providerId": "dumplingai", "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "json", "kind": "connector-proxy" } } }, "n_9236fbb520b48b8b": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_df844678b2c07259", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_df844678b2c07259", "output": "statusCode" } ] }, "bodyEncoding": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_df844678b2c07259", "output": "bodyEncoding" } ] } }, "name": "Prepare sheet rows", "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": "array", "items": { "type": "array", "items": { "type": [ "string", "number", "boolean" ] } } }, "nullable": false, "handle": "rows" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "hasRows" } ], "name": "Prepare sheet rows", "moduleId": "n_714bc87c7c592309", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_2ca80b199430f2de": { "inputs": { "rows": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_9236fbb520b48b8b", "output": "rows" } ] }, "previous": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2ca80b199430f2de", "output": "state" } ] } }, "name": "Prepare the next place", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "array", "items": { "type": [ "string", "number", "boolean" ] } } }, "nullable": false, "handle": "rows" }, { "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": "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 to append." }, "nullable": false, "handle": "values" } ], "name": "Prepare the next place", "moduleId": "n_ad86c21819fe83fc", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_b26d9950417f29fc": { "inputs": {}, "name": "More places?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "append", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_2ca80b199430f2de", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_77fe52f8e8af6a5a": { "inputs": { "spreadsheetId": { "kind": "value", "value": "YOUR_SPREADSHEET_ID" }, "range": { "kind": "value", "value": "'Sheet1'!A:I" }, "values": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2ca80b199430f2de", "output": "values" } ] }, "majorDimension": { "kind": "value", "value": "ROWS" }, "valueInputOption": { "kind": "value", "value": "RAW" }, "insertDataOption": { "kind": "value", "value": "INSERT_ROWS" } }, "name": "Append the place", "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 append values after.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The A1 notation of the range to append values after." }, "nullable": false, "handle": "range" }, { "description": "The data to append.", "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 to append." }, "nullable": false, "handle": "values" }, { "description": "The major dimension of the values array.", "jsonSchema": { "type": "string", "enum": [ "ROWS", "COLUMNS" ], "description": "The major dimension of the values array." }, "nullable": true, "handle": "majorDimension", "value": null }, { "description": "How the data should be inserted.", "jsonSchema": { "type": "string", "enum": [ "OVERWRITE", "INSERT_ROWS" ], "description": "How the data should be inserted." }, "nullable": true, "handle": "insertDataOption", "value": null }, { "description": "How the input data should be interpreted.", "jsonSchema": { "type": "string", "enum": [ "RAW", "USER_ENTERED" ], "description": "How the input data should be interpreted." }, "nullable": true, "handle": "valueInputOption", "value": null }, { "description": "Whether to include the appended values in the response.", "jsonSchema": { "type": "boolean", "description": "Whether to include the appended values in the response." }, "nullable": true, "handle": "includeValuesInResponse", "value": null }, { "description": "How values in the response should be rendered.", "jsonSchema": { "type": "string", "enum": [ "FORMATTED_VALUE", "UNFORMATTED_VALUE", "FORMULA" ], "description": "How values in the response should be rendered." }, "nullable": true, "handle": "responseValueRenderOption", "value": null }, { "description": "How dates in the response should be rendered.", "jsonSchema": { "type": "string", "enum": [ "SERIAL_NUMBER", "FORMATTED_STRING" ], "description": "How dates in the response should be rendered." }, "nullable": true, "handle": "responseDateTimeRenderOption", "value": null } ], "outputs": [ { "description": "The unique ID of the spreadsheet.", "jsonSchema": { "type": "string", "description": "The unique ID of the spreadsheet." }, "nullable": false, "handle": "spreadsheetId" }, { "description": "The A1 notation of the range that was updated.", "jsonSchema": { "type": "string", "description": "The A1 notation of the range that was updated." }, "nullable": false, "handle": "updatedRange" }, { "description": "The number of rows that were updated.", "jsonSchema": { "type": "integer", "description": "The number of rows that were updated." }, "nullable": false, "handle": "updatedRows" }, { "description": "The number of columns that were updated.", "jsonSchema": { "type": "integer", "description": "The number of columns that were updated." }, "nullable": false, "handle": "updatedColumns" }, { "description": "The number of cells that were updated.", "jsonSchema": { "type": "integer", "description": "The number of cells that were updated." }, "nullable": false, "handle": "updatedCells" }, { "description": "The values of the cells after the update.", "jsonSchema": { "type": "object", "properties": { "range": { "type": "string", "description": "The A1 notation of the range." }, "majorDimension": { "type": "string", "description": "The major dimension of the values (ROWS or COLUMNS)." }, "values": { "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." } }, "required": [ "range", "majorDimension", "values" ], "additionalProperties": false, "description": "The values of the cells after the update." }, "nullable": true, "handle": "updatedData" }, { "description": "The A1 notation of the table range that data was appended to.", "jsonSchema": { "type": "string", "description": "The A1 notation of the table range that data was appended to." }, "nullable": false, "handle": "tableRange" } ], "name": "Append the place", "executor": { "kind": "connector", "action": "googlesheets.spreadsheets_values_append" } } }, "n_e4585db9c930c11c": { "inputs": { "updatedRows": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_77fe52f8e8af6a5a", "output": "updatedRows" } ] } }, "name": "Confirm the append", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "integer", "description": "The number of rows that were updated." }, "nullable": false, "handle": "updatedRows" } ], "outputs": [], "name": "Confirm the append", "moduleId": "n_228d869e619c4487", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } } }, "edges": [ { "source": "n_66bdc4f3dc6dc751", "target": "n_f87acc9341b9ae72" }, { "source": "n_f87acc9341b9ae72", "target": "n_df844678b2c07259" }, { "source": "n_df844678b2c07259", "target": "n_9236fbb520b48b8b" }, { "source": "n_9236fbb520b48b8b", "target": "n_2ca80b199430f2de" }, { "source": "n_2ca80b199430f2de", "target": "n_b26d9950417f29fc" }, { "source": "n_b26d9950417f29fc", "target": "n_77fe52f8e8af6a5a", "sourceHandle": "append" }, { "source": "n_77fe52f8e8af6a5a", "target": "n_e4585db9c930c11c" }, { "source": "n_e4585db9c930c11c", "target": "n_2ca80b199430f2de" } ] } }, "modules": { "n_d21d375ea8f0cf89": { "name": "Set the search query", "imports": [], "source": "export default function query({query}){if(typeof query!=='string'||!query.trim()||query.length>1000)throw Error('Enter a search query');return {body:{query:query.trim(),language:'en'}};}\n" }, "n_714bc87c7c592309": { "name": "Prepare sheet rows", "imports": [], "source": "export default function rows({body,statusCode,bodyEncoding}){if(statusCode<200||statusCode>=300||bodyEncoding!==null||!body||!Array.isArray(body.places))throw Error('Maps search failed or returned no places array');const scalar=x=>x==null?'':(typeof x==='string'||typeof x==='boolean'||(typeof x==='number'&&Number.isFinite(x)))?x:(()=>{throw Error('Invalid place field')})();const rows=body.places.map(p=>{if(!p||typeof p.title!=='string'||typeof p.address!=='string')throw Error('Invalid place');if(p.bookingLinks!=null&&!Array.isArray(p.bookingLinks))throw Error('Invalid booking links');return [p.title,p.address,scalar(p.rating),scalar(p.priceLevel),scalar(p.type),scalar(p.bookingLinks?.[0]),scalar(p.website),scalar(p.phoneNumber),scalar(p.position)]});return {rows,hasRows:rows.length>0};}\n" }, "n_ad86c21819fe83fc": { "name": "Prepare the next place", "imports": [], "source": "export default function next({rows,previous}){const i=previous?.next??0;if(!Array.isArray(rows)||!Number.isInteger(i)||i<0||i>rows.length)throw Error('Invalid row state');return {state:{next:i+1},more:i