{ "kind": "open-flow-workflow", "version": 1, "name": "Check a European Company Register", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_6acd1a394aa342b8": { "name": "Receive a company query", "kind": "webhook", "bodyFields": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "data" } ], "method": "POST", "options": { "responseStatusCode": 200 } }, "n_c12bd08dc917cccf": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_6acd1a394aa342b8", "output": "body" } ] } }, "name": "Prepare the register query", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": { "description": "A JSON-compatible Apify value." }, "description": "The JSON input object passed to the actor run." }, "nullable": true, "handle": "input" } ], "name": "Prepare the register query", "moduleId": "n_9dd7f0db130a8194", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_a78b298216e62457": { "inputs": { "actorId": { "kind": "value", "value": "gubidonius~company-registry-lookup" }, "input": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c12bd08dc917cccf", "output": "input" } ] }, "timeoutSecs": { "kind": "value", "value": 600 }, "memoryMbytes": { "kind": "value", "value": 1024 } }, "name": "Start the register lookup", "kind": "task", "task": { "inputs": [ { "description": "The Apify actor identifier, such as apify~web-scraper or apify/web-scraper.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The Apify actor identifier, such as apify~web-scraper or apify/web-scraper." }, "nullable": false, "handle": "actorId" }, { "description": "The JSON input object passed to the actor run.", "jsonSchema": { "type": "object", "additionalProperties": { "description": "A JSON-compatible Apify value." }, "description": "The JSON input object passed to the actor run." }, "nullable": true, "handle": "input", "value": null }, { "description": "The actor build tag or number to run.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The actor build tag or number to run." }, "nullable": true, "handle": "build", "value": null }, { "description": "The memory limit for the run in megabytes.", "jsonSchema": { "type": "integer", "exclusiveMinimum": 0, "description": "The memory limit for the run in megabytes." }, "nullable": true, "handle": "memoryMbytes", "value": null }, { "description": "The maximum runtime for the run in seconds.", "jsonSchema": { "type": "integer", "exclusiveMinimum": 0, "description": "The maximum runtime for the run in seconds." }, "nullable": true, "handle": "timeoutSecs", "value": null } ], "outputs": [ { "description": "An Apify actor run.", "jsonSchema": { "type": "object", "properties": { "id": { "type": "string", "description": "The Apify run identifier." }, "actId": { "type": "string", "description": "The actor identifier associated with the run." }, "status": { "type": "string", "description": "The current run status." }, "startedAt": { "type": "string", "description": "When the run started." }, "finishedAt": { "type": "string", "description": "When the run finished." }, "defaultDatasetId": { "type": "string", "description": "The default dataset identifier created for the run." }, "defaultKeyValueStoreId": { "type": "string", "description": "The default key-value store identifier created for the run." }, "defaultRequestQueueId": { "type": "string", "description": "The default request queue identifier created for the run." }, "stats": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The run statistics object." }, "options": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The run options object." }, "usage": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The run usage summary object." } }, "required": [ "id", "actId", "status" ], "additionalProperties": true, "description": "An Apify actor run." }, "nullable": false, "handle": "run" } ], "name": "Start the register lookup", "executor": { "kind": "connector", "action": "apify.run_actor" } } }, "n_eddf0167f85b4c68": { "inputs": { "initial": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a78b298216e62457", "output": "run" } ] }, "previous": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_eddf0167f85b4c68", "output": "state" } ] }, "current": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_55e6220dc9cfb583", "output": "run" } ] } }, "name": "Check lookup status", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "properties": { "id": { "type": "string", "description": "The Apify run identifier." }, "actId": { "type": "string", "description": "The actor identifier associated with the run." }, "status": { "type": "string", "description": "The current run status." }, "startedAt": { "type": "string", "description": "When the run started." }, "finishedAt": { "type": "string", "description": "When the run finished." }, "defaultDatasetId": { "type": "string", "description": "The default dataset identifier created for the run." }, "defaultKeyValueStoreId": { "type": "string", "description": "The default key-value store identifier created for the run." }, "defaultRequestQueueId": { "type": "string", "description": "The default request queue identifier created for the run." }, "stats": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The run statistics object." }, "options": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The run options object." }, "usage": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The run usage summary object." } }, "required": [ "id", "actId", "status" ], "additionalProperties": true, "description": "An Apify actor run." }, "nullable": false, "handle": "initial" }, { "jsonSchema": { "type": "object", "properties": { "id": { "type": "string", "description": "The Apify run identifier." }, "actId": { "type": "string", "description": "The actor identifier associated with the run." }, "status": { "type": "string", "description": "The current run status." }, "startedAt": { "type": "string", "description": "When the run started." }, "finishedAt": { "type": "string", "description": "When the run finished." }, "defaultDatasetId": { "type": "string", "description": "The default dataset identifier created for the run." }, "defaultKeyValueStoreId": { "type": "string", "description": "The default key-value store identifier created for the run." }, "defaultRequestQueueId": { "type": "string", "description": "The default request queue identifier created for the run." }, "stats": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The run statistics object." }, "options": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The run options object." }, "usage": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The run usage summary object." } }, "required": [ "id", "actId", "status" ], "additionalProperties": true, "description": "An Apify actor run." }, "nullable": true, "handle": "current" }, { "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": "done" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The Apify actor run identifier." }, "nullable": false, "handle": "runId" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The Apify dataset identifier." }, "nullable": false, "handle": "datasetId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "storeId" } ], "name": "Check lookup status", "moduleId": "n_8128fa871028a8ea", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_44d2a1190b04ca52": { "inputs": {}, "name": "Lookup complete?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "yes", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_eddf0167f85b4c68", "output": "done" } }, "operator": "isTrue" } ] } ] } ] }, "n_c93837180423813e": { "inputs": {}, "name": "Wait for the lookup", "kind": "wait", "inputDefinitions": [], "prompt": "Wait for the lookup", "autoContinue": { "kind": "after", "durationMs": 10000 } }, "n_55e6220dc9cfb583": { "inputs": { "runId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_eddf0167f85b4c68", "output": "runId" } ] }, "waitForFinishSeconds": { "kind": "value", "value": 0 } }, "name": "Read lookup status", "kind": "task", "task": { "inputs": [ { "description": "The Apify actor run identifier.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The Apify actor run identifier." }, "nullable": false, "handle": "runId" }, { "description": "How many seconds to wait for run completion before returning.", "jsonSchema": { "type": "integer", "minimum": 0, "description": "How many seconds to wait for run completion before returning." }, "nullable": true, "handle": "waitForFinishSeconds", "value": null } ], "outputs": [ { "description": "An Apify actor run.", "jsonSchema": { "type": "object", "properties": { "id": { "type": "string", "description": "The Apify run identifier." }, "actId": { "type": "string", "description": "The actor identifier associated with the run." }, "status": { "type": "string", "description": "The current run status." }, "startedAt": { "type": "string", "description": "When the run started." }, "finishedAt": { "type": "string", "description": "When the run finished." }, "defaultDatasetId": { "type": "string", "description": "The default dataset identifier created for the run." }, "defaultKeyValueStoreId": { "type": "string", "description": "The default key-value store identifier created for the run." }, "defaultRequestQueueId": { "type": "string", "description": "The default request queue identifier created for the run." }, "stats": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The run statistics object." }, "options": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The run options object." }, "usage": { "type": "object", "properties": {}, "additionalProperties": true, "description": "The run usage summary object." } }, "required": [ "id", "actId", "status" ], "additionalProperties": true, "description": "An Apify actor run." }, "nullable": false, "handle": "run" } ], "name": "Read lookup status", "executor": { "kind": "connector", "action": "apify.get_run" } } }, "n_420a93f66ace171b": { "inputs": { "datasetId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_eddf0167f85b4c68", "output": "datasetId" } ] }, "limit": { "kind": "value", "value": 6 }, "offset": { "kind": "value", "value": 0 }, "clean": { "kind": "value", "value": false }, "skipHidden": { "kind": "value", "value": false } }, "name": "Read matching companies", "kind": "task", "task": { "inputs": [ { "description": "The Apify dataset identifier.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The Apify dataset identifier." }, "nullable": false, "handle": "datasetId" }, { "description": "The maximum number of items to return.", "jsonSchema": { "type": "integer", "minimum": 1, "description": "The maximum number of items to return." }, "nullable": true, "handle": "limit", "value": null }, { "description": "How many items to skip before returning results.", "jsonSchema": { "type": "integer", "minimum": 0, "description": "How many items to skip before returning results." }, "nullable": true, "handle": "offset", "value": null }, { "description": "Whether hidden fields and empty values should be removed from each item.", "jsonSchema": { "type": "boolean", "description": "Whether hidden fields and empty values should be removed from each item." }, "nullable": true, "handle": "clean", "value": null }, { "description": "Whether fields starting with a hash sign should be skipped.", "jsonSchema": { "type": "boolean", "description": "Whether fields starting with a hash sign should be skipped." }, "nullable": true, "handle": "skipHidden", "value": null } ], "outputs": [ { "description": "The ordered list of Apify dataset items.", "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": { "description": "A JSON-compatible Apify value." }, "description": "A single item returned from an Apify dataset." }, "description": "The ordered list of Apify dataset items." }, "nullable": false, "handle": "items" } ], "name": "Read matching companies", "executor": { "kind": "connector", "action": "apify.get_dataset_items" } } }, "n_23089b44764c5eaa": { "inputs": { "storeId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_eddf0167f85b4c68", "output": "storeId" } ] } }, "name": "Locate the lookup summary", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "storeId" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" } ], "name": "Locate the lookup summary", "moduleId": "n_f3db9182507bec87", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_1cfa2df1e9dac4e9": { "inputs": { "endpoint": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_23089b44764c5eaa", "output": "endpoint" } ] } }, "name": "Read the lookup summary", "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 the lookup summary", "executor": { "providerId": "apify", "method": "GET", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "none", "kind": "connector-proxy" } } }, "n_dc6cdfec52ea76ef": { "inputs": { "items": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_420a93f66ace171b", "output": "items" } ] }, "summary": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_1cfa2df1e9dac4e9", "output": "body" } ] }, "status": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_1cfa2df1e9dac4e9", "output": "statusCode" } ] } }, "name": "Classify the company records", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": { "description": "A JSON-compatible Apify value." }, "description": "A single item returned from an Apify dataset." }, "description": "The ordered list of Apify dataset items." }, "nullable": false, "handle": "items" }, { "jsonSchema": {}, "nullable": true, "handle": "summary" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "status" } ], "outputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "records" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "summary" } ], "name": "Classify the company records", "moduleId": "n_3cb084eac6509496", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_19be2538385970de": { "name": "Company check results", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "records" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "summary" } ], "outputMappings": { "records": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_dc6cdfec52ea76ef", "output": "records" } ] }, "summary": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_dc6cdfec52ea76ef", "output": "summary" } ] } } } }, "edges": [ { "source": "n_6acd1a394aa342b8", "target": "n_c12bd08dc917cccf" }, { "source": "n_c12bd08dc917cccf", "target": "n_a78b298216e62457" }, { "source": "n_a78b298216e62457", "target": "n_eddf0167f85b4c68" }, { "source": "n_eddf0167f85b4c68", "target": "n_44d2a1190b04ca52" }, { "source": "n_44d2a1190b04ca52", "target": "n_420a93f66ace171b", "sourceHandle": "yes" }, { "source": "n_44d2a1190b04ca52", "target": "n_c93837180423813e", "sourceHandle": "otherwise" }, { "source": "n_c93837180423813e", "target": "n_55e6220dc9cfb583", "sourceHandle": "continue" }, { "source": "n_55e6220dc9cfb583", "target": "n_eddf0167f85b4c68" }, { "source": "n_420a93f66ace171b", "target": "n_23089b44764c5eaa" }, { "source": "n_23089b44764c5eaa", "target": "n_1cfa2df1e9dac4e9" }, { "source": "n_1cfa2df1e9dac4e9", "target": "n_dc6cdfec52ea76ef" }, { "source": "n_dc6cdfec52ea76ef", "target": "n_19be2538385970de" } ] } }, "modules": { "n_9dd7f0db130a8194": { "name": "Prepare the register query", "imports": [], "source": "export default function input({body}){const query=body.data?.['Company name or registration number'],country=body.data?.Country;if(typeof query!=='string'||!query.trim()||!['cz','ee','fi','fr','no','pl','sk'].includes(country))throw Error('A company query and supported country are required');return{input:{queries:[query.trim()],countries:[country],maxResultsPerQuery:5,onlyActive:false}};}\n" }, "n_8128fa871028a8ea": { "name": "Check lookup status", "imports": [], "source": "export default function run({initial,current,previous}){const x=current??initial;if(!x||typeof x.id!=='string'||!x.id||typeof x.status!=='string')throw Error('Invalid Apify run');if(previous?.id&&previous.id!==x.id)throw Error('Apify run changed');if(['FAILED','ABORTED','TIMED-OUT'].includes(x.status))throw Error('Registry run failed: '+x.status);const done=x.status==='SUCCEEDED';if(done&&(!x.defaultDatasetId||!x.defaultKeyValueStoreId))throw Error('Registry run is missing its dataset or summary store');const count=(previous?.count??0)+1;if(!done&&count>90)throw Error('Registry run did not complete in time');return{state:{id:x.id,count},done,runId:x.id,datasetId:x.defaultDatasetId??'pending',storeId:x.defaultKeyValueStoreId??'pending'};}\n" }, "n_f3db9182507bec87": { "name": "Locate the lookup summary", "imports": [], "source": "export default function summary({storeId}){if(typeof storeId!=='string'||!/^[a-zA-Z0-9_-]+$/.test(storeId))throw Error('Invalid Apify summary store');return{endpoint:'/v2/key-value-stores/'+encodeURIComponent(storeId)+'/records/SUMMARY'};}\n" }, "n_3cb084eac6509496": { "name": "Classify the company records", "imports": [], "source": "export default function result({items,summary,status}){if(status!==200||!summary||typeof summary!=='object'||Array.isArray(summary))throw Error('Registry run summary is unavailable');if(!Array.isArray(items)||items.length>5)throw Error('Invalid registry result count');const records=items.map(x=>{if(!x||typeof x.name!=='string'||typeof x.status!=='string')throw Error('Invalid company record');if(x.status.toLowerCase()==='active')return{verdict:'ok',company:x.name,registrationNumber:x.registrationNumber??null,country:x.countryName??null,legalForm:x.legalFormCode??null,address:x.address??null,vatNumber:x.vatNumber??null,registryUrl:x.registryUrl??null,registryUpdatedAt:x.registryUpdatedAt??null};return{verdict:'check by hand',company:x.name,status:x.status,statusRaw:x.statusRaw??null,dissolvedAt:x.dissolvedAt??null,registryUrl:x.registryUrl??null};});return{records,summary};}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }