This workflow corresponds to n8n.io template #4072 — we link there as the canonical source.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "45b55e87-08a0-44e5-a220-5d9110ac364e",
"name": "When clicking \u2018Test workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-1960,
480
],
"parameters": {},
"typeVersion": 1
},
{
"id": "6daee671-8b07-4101-b57a-5dd7a9966c5e",
"name": "Postgres1",
"type": "n8n-nodes-base.postgres",
"position": [
3000,
480
],
"parameters": {
"table": {
"__rl": true,
"mode": "name",
"value": "=seller_data"
},
"schema": {
"__rl": true,
"mode": "list",
"value": "public"
},
"columns": {
"value": {
"seller_id": "={{ $('Process by Batch').item.json.seller_id.toNumber() }}",
"primary_email": "={{ $json.data[0].email }}"
},
"schema": [
{
"id": "seller_id",
"type": "number",
"display": true,
"removed": false,
"required": true,
"displayName": "seller_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "seller_name",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "seller_name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "primary_email",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "primary_email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "company_info",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "company_info",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "trade_name",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "trade_name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "business_address",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "business_address",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "coc_number",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "coc_number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "vat_number",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "vat_number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "commercial_register",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "commercial_register",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "secondary_email",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "secondary_email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "domain",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "domain",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "seller_slug",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "seller_slug",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "source",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "source",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"seller_id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update"
},
"credentials": {
"postgres": {
"name": "<your credential>"
}
},
"typeVersion": 2.5
},
{
"id": "b79a33a6-3d15-44cf-b043-3e33cdb09cbf",
"name": "Wait",
"type": "n8n-nodes-base.wait",
"position": [
3620,
1300
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "b4e9b540-49f4-48d5-abf9-5008412a86bc",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-1960,
720
],
"parameters": {
"rule": {
"interval": [
{
"field": "minutes"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "4847e2e0-8abe-4d10-b04b-85b4ee318c83",
"name": "Postgres2",
"type": "n8n-nodes-base.postgres",
"position": [
3020,
1020
],
"parameters": {
"table": {
"__rl": true,
"mode": "name",
"value": "seller_data"
},
"schema": {
"__rl": true,
"mode": "list",
"value": "public"
},
"columns": {
"value": {
"seller_id": "={{ $('Switch').item.json.seller_id.toNumber() }}"
},
"schema": [
{
"id": "seller_id",
"type": "number",
"display": true,
"removed": false,
"required": true,
"displayName": "seller_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "seller_name",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "seller_name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "primary_email",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "primary_email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "company_info",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "company_info",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "trade_name",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "trade_name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "business_address",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "business_address",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "coc_number",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "coc_number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "vat_number",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "vat_number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "commercial_register",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "commercial_register",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "secondary_email",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "secondary_email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "domain",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "domain",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "seller_slug",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "seller_slug",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "source",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "source",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"seller_id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update"
},
"credentials": {
"postgres": {
"name": "<your credential>"
}
},
"typeVersion": 2.5
},
{
"id": "e513e68c-9fe6-48e9-98c9-fd2787926619",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
-680,
660
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Domain exists",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.domain }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "No domain but with business address and trade name",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "23e3cde8-3f9e-48d2-8353-b286df20d139",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ !$json.domain && $json.business_address && $json.trade_name ? true : false }}",
"rightValue": "=no_domain"
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"typeVersion": 3.2
},
{
"id": "5fa56857-8607-430d-ac9e-0105f377cfbe",
"name": "Code",
"type": "n8n-nodes-base.code",
"position": [
2320,
840
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "function extractWebsiteName(url) {\n //const newUrl = url || \"\"\n const mainDomain = url.replace(/^(?:.*\\.)?([^\\.]+)\\.[^\\.]+$/, '$1');\n console.log(mainDomain);\n return mainDomain;\n}\n\nfunction normalizeName(name) {\n if (!name) {\n return null\n }\n return name.toLowerCase().replace(/[\\s&,.\u2122\u00ae]/g, '');\n}\n\nfunction isWebsiteBelongsToCompany(url, sellerName, tradeName) {\n const websiteName = extractWebsiteName(url);\n console.log(\"websiteName: \" + websiteName);\n if (!websiteName) return false;\n\n const normalizedWebsiteName = websiteName.toLowerCase();\n const normalizedSellerName = normalizeName(sellerName);\n const normalizedTradeName = normalizeName(tradeName);\n\n return normalizedWebsiteName.includes(normalizedSellerName) || \n normalizedWebsiteName.includes(normalizedTradeName) ||\n normalizedSellerName.includes(normalizedWebsiteName) ||\n normalizedTradeName.includes(normalizedWebsiteName);\n}\n\ntry {\n\nconst url1 = $json.first_url;\nconst sellerName = $json.seller_name;\nconst tradeName = $json.trade_name;\n\nconst belongsToCompany1 = isWebsiteBelongsToCompany(url1, sellerName, tradeName);\nconsole.log(belongsToCompany1);\n\nconst url2 = $json.second_url;\nconst belongsToCompany2 = isWebsiteBelongsToCompany(url2, sellerName, tradeName);\nconsole.log(belongsToCompany2);\n\nfunction rootDomain(domain) {\n return domain.replace(/^(?:www\\.)?(?:[^.]+\\.)?([^\\.]+\\.[^\\.]+)$/, '$1');\n}\n\nreturn {\n rootDomain: belongsToCompany1 ? rootDomain(url1) : belongsToCompany2 ? rootDomain(url2) : null,\n first_url: url1,\n second_url: url2,\n extracted_email: $json.extracted_email,\n seller_name: sellerName,\n trade_name: tradeName,\n seller_slug: $json.seller_slug\n\n}\n\n \n} catch (error) {\n return {\n rootDomain: null,\n first_url: $json.first_url,\n second_url: $json.second_url,\n extracted_email: $json.extracted_email,\n seller_name: $json.seller_name,\n trade_name: $json.trade_name,\n seller_slug: $json.seller_slug\n }\n}"
},
"typeVersion": 2
},
{
"id": "426cf1bc-f5e5-4f59-b727-b8baa5b715bb",
"name": "Postgres3",
"type": "n8n-nodes-base.postgres",
"position": [
3000,
660
],
"parameters": {
"table": {
"__rl": true,
"mode": "name",
"value": "=seller_data"
},
"schema": {
"__rl": true,
"mode": "list",
"value": "public"
},
"columns": {
"value": {
"domain": "={{ $json.rootDomain }}",
"seller_id": "={{ $('Process by Batch').item.json.seller_id.toNumber() }}",
"primary_email": "={{ $json.extracted_email }}"
},
"schema": [
{
"id": "seller_id",
"type": "number",
"display": true,
"removed": false,
"required": true,
"displayName": "seller_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "seller_name",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "seller_name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "primary_email",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "primary_email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "company_info",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "company_info",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "trade_name",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "trade_name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "business_address",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "business_address",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "coc_number",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "coc_number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "vat_number",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "vat_number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "commercial_register",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "commercial_register",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "secondary_email",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "secondary_email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "domain",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "domain",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "seller_slug",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "seller_slug",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "source",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "source",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"seller_id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update"
},
"credentials": {
"postgres": {
"name": "<your credential>"
}
},
"typeVersion": 2.5
},
{
"id": "e399a71c-46d2-4930-89a6-f976987ed3b3",
"name": "Switch1",
"type": "n8n-nodes-base.switch",
"position": [
2580,
840
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "extracted email matches the first two domains",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.extracted_email && $json.rootDomain && $json.extracted_email.includes($json.rootDomain) ? true : false }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "domain does not match with extracted email",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "08bd4bcb-44da-4a2b-9687-8216e24869cc",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.extracted_email && $json.rootDomain && !$json.extracted_email.includes($json.rootDomain) ? true : false }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "no extracted email but with root domain",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "059ab924-f2e7-4d8f-99c6-c63eb3fd90c7",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ !$json.extracted_email && $json.rootDomain ? true : false }}",
"rightValue": ""
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"typeVersion": 3.2
},
{
"id": "00cfa54d-3776-4564-8a22-d15b27b8effe",
"name": "Postgres4",
"type": "n8n-nodes-base.postgres",
"position": [
3000,
840
],
"parameters": {
"table": {
"__rl": true,
"mode": "name",
"value": "seller_data"
},
"schema": {
"__rl": true,
"mode": "list",
"value": "public"
},
"columns": {
"value": {
"domain": "={{ $json.rootDomain }}",
"seller_id": "={{ $('Process by Batch').item.json.seller_id.toNumber() }}"
},
"schema": [
{
"id": "seller_id",
"type": "number",
"display": true,
"removed": false,
"required": true,
"displayName": "seller_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "seller_name",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "seller_name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "primary_email",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "primary_email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "company_info",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "company_info",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "trade_name",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "trade_name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "business_address",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "business_address",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "coc_number",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "coc_number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "vat_number",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "vat_number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "commercial_register",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "commercial_register",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "secondary_email",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "secondary_email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "domain",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "domain",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "seller_slug",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "seller_slug",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "source",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "source",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"seller_id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update"
},
"credentials": {
"postgres": {
"name": "<your credential>"
}
},
"typeVersion": 2.5
},
{
"id": "dbe77304-ba70-49d7-81ee-3afffcae7820",
"name": "Wait1",
"type": "n8n-nodes-base.wait",
"position": [
420,
560
],
"parameters": {
"amount": 2
},
"typeVersion": 1.1
},
{
"id": "34d5cbe7-2c3f-4bfd-888b-e0a4f81cd962",
"name": "Edit Fields3",
"type": "n8n-nodes-base.set",
"position": [
1680,
720
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "0ba46b0e-093f-480a-8ae7-20f826c643a9",
"name": "first_url",
"type": "string",
"value": "={{ $('HTML1').item.json.element[0].match(/https?:\\/\\/[^\\s/$.?#].[^\\s]*/g).filter(item => !item.includes(\"google\"))[0] }}"
},
{
"id": "9533866a-04b5-4ef2-82da-98017d6ace77",
"name": "extracted_email",
"type": "string",
"value": "={{ $('HTML1').item.json.element.join().match(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}/)[0] }}"
},
{
"id": "fd0f8699-772a-4525-8122-68a7ed27f2db",
"name": "second_url",
"type": "string",
"value": "={{ $('HTML1').item.json.element[1].match(/https?:\\/\\/[^\\s/$.?#].[^\\s]*/g).filter(item => !item.includes(\"google\"))[0] }}"
},
{
"id": "b3e2f080-1174-4f61-a258-86b7f5c468e1",
"name": "seller_name",
"type": "string",
"value": "={{ $('Switch').item.json.seller_name }}"
},
{
"id": "d990a86d-ecef-469b-b344-771956093011",
"name": "trade_name",
"type": "string",
"value": "={{ $('Switch').item.json.trade_name }}"
},
{
"id": "37c43cb0-cb53-4098-9074-ea228b71d820",
"name": "seller_slug",
"type": "string",
"value": "={{ $('Switch').item.json.seller_slug }}"
},
{
"id": "194e5535-399b-4cb1-8935-361eedf1f983",
"name": "rootDomain",
"type": "string",
"value": "={{ $('HTML1').item.json.element[0].match(/https?:\\/\\/[^\\s/$.?#].[^\\s]*/g).filter(item => !item.includes(\"google\"))[0].extractDomain() }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "759cac41-3a78-499d-b529-8ae6f4bb51ea",
"name": "Process by Batch",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-960,
640
],
"parameters": {
"options": {},
"batchSize": 5
},
"typeVersion": 3
},
{
"id": "2a432d7a-cbe8-4334-b8c2-febfe5696c83",
"name": "BrightData",
"type": "n8n-nodes-brightdata.brightData",
"position": [
-120,
240
],
"parameters": {
"url": "=https://www.google.com/search?q={{ $json.domain }}+email",
"zone": {
"__rl": true,
"mode": "list",
"value": "web_unlocker1",
"cachedResultName": "web_unlocker1"
},
"format": "json",
"country": {
"__rl": true,
"mode": "list",
"value": "us"
},
"requestOptions": {}
},
"credentials": {
"brightdataApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "db49e284-72b4-41b7-8ca1-96335c46e11f",
"name": "BrightData1",
"type": "n8n-nodes-brightdata.brightData",
"position": [
800,
720
],
"parameters": {
"url": "=https://www.google.com/search?q=email+{{ encodeURIComponent($('Switch').item.json.trade_name || $('Switch').item.json.seller_name) }}+{{ encodeURIComponent($('Switch').item.json.business_address) }}",
"zone": {
"__rl": true,
"mode": "list",
"value": "web_unlocker1",
"cachedResultName": "web_unlocker1"
},
"format": "json",
"country": {
"__rl": true,
"mode": "list",
"value": "us"
},
"requestOptions": {}
},
"credentials": {
"brightdataApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "312ff218-353d-4d2c-a7e4-6a2bc133f828",
"name": "HTML",
"type": "n8n-nodes-base.html",
"position": [
40,
240
],
"parameters": {
"options": {},
"operation": "extractHtmlContent",
"dataPropertyName": "body",
"extractionValues": {
"values": [
{
"key": "element",
"cssSelector": "div[jscontroller] .N54PNb",
"returnArray": true,
"skipSelectors": "img"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "e1ec0679-fde7-4a62-b162-dc3a6be50b8e",
"name": "HTML1",
"type": "n8n-nodes-base.html",
"position": [
980,
720
],
"parameters": {
"options": {},
"operation": "extractHtmlContent",
"dataPropertyName": "body",
"extractionValues": {
"values": [
{
"key": "element",
"cssSelector": "div[jscontroller] .N54PNb",
"returnArray": true,
"skipSelectors": "img"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "ea68bca8-7f10-49d3-a14d-e46cc4c793ba",
"name": "Split Out",
"type": "n8n-nodes-base.splitOut",
"position": [
360,
240
],
"parameters": {
"options": {
"destinationFieldName": "email"
},
"fieldToSplitOut": "emails"
},
"typeVersion": 1
},
{
"id": "02b202cd-1a45-49a5-997a-35a692598f02",
"name": "Filter",
"type": "n8n-nodes-base.filter",
"position": [
500,
240
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a07e75fc-522c-4861-a842-cf880c398a44",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.email }}",
"rightValue": "={{ $('Process by Batch').item.json.domain.replace(/^(?:www\\.)?(?:[^.]+\\.)?([^\\.]+\\.[^\\.]+)$/, '$1').toLowerCase() }}"
}
]
}
},
"typeVersion": 2.2,
"alwaysOutputData": true
},
{
"id": "f15a901a-5225-4450-949b-6fb5769c6564",
"name": "Aggregate",
"type": "n8n-nodes-base.aggregate",
"position": [
660,
240
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "a403ff04-ed4e-43f4-abd6-261173b7d63d",
"name": "Code2",
"type": "n8n-nodes-base.code",
"position": [
1140,
720
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "function extractEmails(text) {\n // Regular expression to match most common email patterns\n const emailRegex = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}/g;\n // matchAll returns an iterator so we spread it into an array\n const matches = [...text.matchAll(emailRegex)];\n return matches.map(match => decodeURI(match[0]).trim());\n}\n\n\nconst sampleText = $json.element.join();\nconst emails = extractEmails(sampleText);\nconsole.log(emails); // Expected: [ 'user@example.com', 'user@example.com', 'user@example.com' ]\nreturn {emails}\n"
},
"typeVersion": 2
},
{
"id": "4fd9ec2d-14e4-4765-bdad-1e33dd93d8c1",
"name": "Split Out1",
"type": "n8n-nodes-base.splitOut",
"position": [
1280,
720
],
"parameters": {
"options": {
"destinationFieldName": "email"
},
"fieldToSplitOut": "emails"
},
"typeVersion": 1
},
{
"id": "69e9a05d-9b30-409e-a94b-888828aa5dc1",
"name": "Filter1",
"type": "n8n-nodes-base.filter",
"position": [
1400,
720
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a07e75fc-522c-4861-a842-cf880c398a44",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.email }}",
"rightValue": "={{ $('Process by Batch').item.json.domain.replace(/^(?:www\\.)?(?:[^.]+\\.)?([^\\.]+\\.[^\\.]+)$/, '$1').toLowerCase() }}"
}
]
}
},
"typeVersion": 2.2,
"alwaysOutputData": true
},
{
"id": "a317567a-1d69-41b8-bab1-f656627381e4",
"name": "If2",
"type": "n8n-nodes-base.if",
"position": [
1900,
720
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "bcb1a1ee-0720-4cbd-ae3c-cb4ebca5acfa",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.data[0]?.email }}",
"rightValue": 0
}
]
}
},
"typeVersion": 2.2
},
{
"id": "6ec5cc13-8e67-43a7-bec3-81b8ba8121b7",
"name": "Aggregate1",
"type": "n8n-nodes-base.aggregate",
"position": [
1540,
720
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "3f62b698-1948-45cf-bf70-467dd36e7c81",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-160,
40
],
"parameters": {
"width": 1000,
"height": 460,
"content": "## Search Domain+Email in Google using Bright Data\nIf the domain exist, use the search query \"{{$json.domain}}+email\"."
},
"typeVersion": 1
},
{
"id": "30aa345b-90d1-4012-a3ba-81194ad676a1",
"name": "Check if email exists",
"type": "n8n-nodes-base.if",
"position": [
920,
240
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "bcb1a1ee-0720-4cbd-ae3c-cb4ebca5acfa",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.data[0]?.email }}",
"rightValue": 0
}
]
}
},
"typeVersion": 2.2
},
{
"id": "4da7a7a8-3eca-4f20-af2f-9fc0baf9b9b0",
"name": "Extract Emails",
"type": "n8n-nodes-base.code",
"position": [
200,
240
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "function extractEmails(text) {\n // Regular expression to match most common email patterns\n const emailRegex = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}/g;\n // matchAll returns an iterator so we spread it into an array\n const matches = [...text.matchAll(emailRegex)];\n return matches.map(match => decodeURI(match[0]).trim());\n}\n\n\nconst sampleText = $json.element.join();\nconst emails = extractEmails(sampleText);\nconsole.log(emails); // Expected: [ 'user@example.com', 'user@example.com', 'user@example.com' ]\nreturn {emails}\n"
},
"typeVersion": 2
},
{
"id": "43557ff1-642c-41b3-b6e9-cfc5de650428",
"name": "Read the Database",
"type": "n8n-nodes-base.postgres",
"position": [
-1280,
640
],
"parameters": {
"sort": {
"values": [
{
"column": "seller_id"
}
]
},
"limit": 60,
"table": {
"__rl": true,
"mode": "name",
"value": "seller_data"
},
"where": {
"values": [
{
"column": "primary_email",
"condition": "IS NULL"
}
]
},
"schema": {
"__rl": true,
"mode": "list",
"value": "public"
},
"options": {},
"operation": "select"
},
"credentials": {
"postgres": {
"name": "<your credential>"
}
},
"typeVersion": 2.5
},
{
"id": "5ae7d1e1-c626-4553-85c0-07c5f3ea96c6",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
720,
560
],
"parameters": {
"width": 1140,
"height": 460,
"content": "## Search Seller Name+Address+Email in Google using Bright Data\nIf the domain exist, use the search query \"{{$json.seller_name}}+{{ $json.seller_address }}+email\"."
},
"typeVersion": 1
},
{
"id": "7dfb9013-7c0e-43d0-ba44-afb02ed0834e",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
2240,
340
],
"parameters": {
"width": 980,
"height": 960,
"content": "## Clean up the data and save it to Postgres database"
},
"typeVersion": 1
},
{
"id": "2034fa79-9c65-4cd8-9b74-f9f9301310f5",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1340,
460
],
"parameters": {
"width": 960,
"height": 540,
"content": "## Read and iterate through the database\n"
},
"typeVersion": 1
}
],
"connections": {
"If2": {
"main": [
[
{
"node": "Postgres1",
"type": "main",
"index": 0
}
],
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Switch1",
"type": "main",
"index": 0
}
]
]
},
"HTML": {
"main": [
[
{
"node": "Extract Emails",
"type": "main",
"index": 0
}
]
]
},
"Wait": {
"main": [
[
{
"node": "Process by Batch",
"type": "main",
"index": 0
}
]
]
},
"Code2": {
"main": [
[
{
"node": "Split Out1",
"type": "main",
"index": 0
}
]
]
},
"HTML1": {
"main": [
[
{
"node": "Code2",
"type": "main",
"index": 0
}
]
]
},
"Wait1": {
"main": [
[
{
"node": "BrightData1",
"type": "main",
"index": 0
}
]
]
},
"Filter": {
"main": [
[
{
"node": "Aggregate",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "BrightData",
"type": "main",
"index": 0
}
],
[
{
"node": "BrightData1",
"type": "main",
"index": 0
}
],
[
{
"node": "Postgres2",
"type": "main",
"index": 0
}
]
]
},
"Filter1": {
"main": [
[
{
"node": "Aggregate1",
"type": "main",
"index": 0
}
]
]
},
"Switch1": {
"main": [
[
{
"node": "Postgres3",
"type": "main",
"index": 0
}
],
[
{
"node": "Postgres4",
"type": "main",
"index": 0
}
],
[
{
"node": "Postgres4",
"type": "main",
"index": 0
}
],
[
{
"node": "Postgres2",
"type": "main",
"index": 0
}
]
]
},
"Aggregate": {
"main": [
[
{
"node": "Check if email exists",
"type": "main",
"index": 0
}
]
]
},
"Postgres1": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Postgres2": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Postgres3": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Postgres4": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "Filter",
"type": "main",
"index": 0
}
]
]
},
"Aggregate1": {
"main": [
[
{
"node": "Edit Fields3",
"type": "main",
"index": 0
}
]
]
},
"BrightData": {
"main": [
[
{
"node": "HTML",
"type": "main",
"index": 0
}
]
]
},
"Split Out1": {
"main": [
[
{
"node": "Filter1",
"type": "main",
"index": 0
}
]
]
},
"BrightData1": {
"main": [
[
{
"node": "HTML1",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields3": {
"main": [
[
{
"node": "If2",
"type": "main",
"index": 0
}
]
]
},
"Extract Emails": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"Process by Batch": {
"main": [
[],
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Read the Database",
"type": "main",
"index": 0
}
]
]
},
"Read the Database": {
"main": [
[
{
"node": "Process by Batch",
"type": "main",
"index": 0
}
]
]
},
"Check if email exists": {
"main": [
[
{
"node": "Postgres1",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait1",
"type": "main",
"index": 0
}
]
]
},
"When clicking \u2018Test workflow\u2019": {
"main": [
[
{
"node": "Read the Database",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
brightdataApipostgres
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This N8N workflow is designed to enrich seller data stored in a Postgres database by performing automated Google search lookups. It uses Bright Data's Web Unlocker to bypass search result restrictions and the HTML Extract node to parse and extract relevant information from…
Source: https://n8n.io/workflows/4072/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow acts as a junior finance research analyst for a UK boutique M&A or corporate finance team. It listens for Slack messages, classifies the request, gathers company or market data, and prod
Agendamiento_v2. Uses n8n-nodes-evolution-api, redis, httpRequest, executeWorkflowTrigger. Event-driven trigger; 59 nodes.
Cancelacion_v2. Uses executeWorkflowTrigger, redis, httpRequest, n8n-nodes-evolution-api. Event-driven trigger; 46 nodes.
Components. Uses postgres, readWriteFile. Event-driven trigger; 42 nodes.
Rank Tracker Postgres Template. Uses googleBigQuery, postgres. Event-driven trigger; 28 nodes.