{ "kind": "open-flow-workflow", "version": 1, "name": "Save PhantomBuster Leads to Airtable", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_40960a1526910d7b": { "name": "Start import", "kind": "start", "inputDefs": [] }, "n_4612ec53a5e6dbef": { "inputs": { "agentId": { "kind": "value", "value": "YOUR_PHANTOM_ID" } }, "name": "Set Phantom ID", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "agentId" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" } ], "name": "Set Phantom ID", "moduleId": "n_10c67d560e1f3e12", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_c41ca4d6a19f03b3": { "inputs": { "endpoint": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4612ec53a5e6dbef", "output": "endpoint" } ] } }, "name": "Read latest output", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" } ], "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": "Read latest output", "executor": { "providerId": "phantombuster", "method": "GET", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "none", "kind": "connector-proxy" } } }, "n_a4fdfa41b7e15b60": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c41ca4d6a19f03b3", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c41ca4d6a19f03b3", "output": "statusCode" } ] }, "bodyEncoding": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c41ca4d6a19f03b3", "output": "bodyEncoding" } ] } }, "name": "Find the result container", "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": "string" }, "nullable": false, "handle": "endpoint" } ], "name": "Find the result container", "moduleId": "n_5a8a075e8fab861b", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_6594f1ea3f761d52": { "inputs": { "endpoint": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a4fdfa41b7e15b60", "output": "endpoint" } ] } }, "name": "Read container result", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" } ], "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": "Read container result", "executor": { "providerId": "phantombuster", "method": "GET", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "none", "kind": "connector-proxy" } } }, "n_1e717eb58d015d7d": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_6594f1ea3f761d52", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_6594f1ea3f761d52", "output": "statusCode" } ] }, "bodyEncoding": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_6594f1ea3f761d52", "output": "bodyEncoding" } ] } }, "name": "Prepare lead fields", "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": "object", "additionalProperties": true } }, "nullable": false, "handle": "rows" } ], "name": "Prepare lead fields", "moduleId": "n_6f2fce2bda421841", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_788a1809937e918a": { "inputs": { "rows": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_1e717eb58d015d7d", "output": "rows" } ] }, "previous": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_788a1809937e918a", "output": "state" } ] } }, "name": "Prepare the next lead", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "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": "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 lead", "moduleId": "n_d7bbd55d914772dc", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_9dd979c88920b9f7": { "inputs": {}, "name": "More leads?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "create", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_788a1809937e918a", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_d9cfc6d66d4627e4": { "inputs": { "baseId": { "kind": "value", "value": "YOUR_AIRTABLE_BASE_ID" }, "tableIdOrName": { "kind": "value", "value": "Leads" }, "records": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_788a1809937e918a", "output": "records" } ] }, "typecast": { "kind": "value", "value": false } }, "name": "Create the Airtable record", "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": "Create the Airtable record", "executor": { "kind": "connector", "action": "airtable.create_records" } } }, "n_7c3a0014d2f185a9": { "inputs": { "records": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_d9cfc6d66d4627e4", "output": "records" } ] } }, "name": "Confirm the record", "kind": "task", "task": { "inputs": [ { "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" } ], "outputs": [], "name": "Confirm the record", "moduleId": "n_63fa0812aa55a54d", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } } }, "edges": [ { "source": "n_40960a1526910d7b", "target": "n_4612ec53a5e6dbef" }, { "source": "n_4612ec53a5e6dbef", "target": "n_c41ca4d6a19f03b3" }, { "source": "n_c41ca4d6a19f03b3", "target": "n_a4fdfa41b7e15b60" }, { "source": "n_a4fdfa41b7e15b60", "target": "n_6594f1ea3f761d52" }, { "source": "n_6594f1ea3f761d52", "target": "n_1e717eb58d015d7d" }, { "source": "n_1e717eb58d015d7d", "target": "n_788a1809937e918a" }, { "source": "n_788a1809937e918a", "target": "n_9dd979c88920b9f7" }, { "source": "n_9dd979c88920b9f7", "target": "n_d9cfc6d66d4627e4", "sourceHandle": "create" }, { "source": "n_d9cfc6d66d4627e4", "target": "n_7c3a0014d2f185a9" }, { "source": "n_7c3a0014d2f185a9", "target": "n_788a1809937e918a" } ] } }, "modules": { "n_10c67d560e1f3e12": { "name": "Set Phantom ID", "imports": [], "source": "export default function endpoint({agentId}){if(typeof agentId!=='string'||!agentId.trim())throw Error('Enter a Phantom ID');return {endpoint:'/agents/fetch-output?id='+encodeURIComponent(agentId.trim())};}\n" }, "n_5a8a075e8fab861b": { "name": "Find the result container", "imports": [], "source": "export default function endpoint({body,statusCode,bodyEncoding}){if(statusCode<200||statusCode>=300||bodyEncoding)throw Error('Could not read Phantom output');const id=body?.containerId;if(typeof id!=='string'||!id.trim())throw Error('No container ID in Phantom output');return {endpoint:'/containers/fetch-result-object?id='+encodeURIComponent(id)};}\n" }, "n_6f2fce2bda421841": { "name": "Prepare lead fields", "imports": [], "source": "export default function rows({body,statusCode,bodyEncoding}){if(statusCode<200||statusCode>=300||bodyEncoding)throw Error('Could not read container result');if(!body||!Object.hasOwn(body,'resultObject'))throw Error('Missing result object');if(body.resultObject===null)return {rows:[]};if(typeof body.resultObject!=='string')throw Error('Invalid result object');let parsed;try{parsed=JSON.parse(body.resultObject)}catch{throw Error('Invalid result JSON')};const items=Array.isArray(parsed)?parsed:[parsed];return {rows:items.map((x)=>{const name=x?.general?.fullName,email=x?.details?.mail,company=x?.jobs?.[0]?.companyName;if(typeof name!=='string'||!name.trim()||typeof email!=='string'||!email.trim()||typeof company!=='string'||!company.trim())throw Error('Each result needs general.fullName, details.mail and jobs[0].companyName');return {Name:name,Email:email,Company:company};})};}\n" }, "n_d7bbd55d914772dc": { "name": "Prepare the next lead", "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