Enriquecer datos de vendedores mediante búsqueda por correo electrónico y dominio con Bright Data y Google Search

Avanzado

Este es unSales, AI, Marketingflujo de automatización del dominio deautomatización que contiene 32 nodos.Utiliza principalmente nodos como If, Set, Code, Html, Wait, combinando tecnología de inteligencia artificial para lograr automatización inteligente. usoBright DatayGooglebúsquedaa través de邮箱y域名查找丰富卖家datos

Requisitos previos
  • Información de conexión de la base de datos PostgreSQL
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "meta": {
    "instanceId": "4e6be3a68285934388a854ac0ffdc5e5500688d5cdb88d0ec2d734e85f097355",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "45b55e87-08a0-44e5-a220-5d9110ac364e",
      "name": "Al hacer clic en 'Probar flujo de trabajo'",
      "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": {
          "id": "m6FHVVkUrN3xlE35",
          "name": "Postgres account"
        }
      },
      "typeVersion": 2.5
    },
    {
      "id": "b79a33a6-3d15-44cf-b043-3e33cdb09cbf",
      "name": "Esperar",
      "type": "n8n-nodes-base.wait",
      "position": [
        3620,
        1300
      ],
      "webhookId": "0cbffe1f-700c-4b66-967d-cc85398fc159",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "b4e9b540-49f4-48d5-abf9-5008412a86bc",
      "name": "Activador programado",
      "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": {
          "id": "m6FHVVkUrN3xlE35",
          "name": "Postgres account"
        }
      },
      "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": "Código",
      "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&,.™®]/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": {
          "id": "m6FHVVkUrN3xlE35",
          "name": "Postgres account"
        }
      },
      "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": {
          "id": "m6FHVVkUrN3xlE35",
          "name": "Postgres account"
        }
      },
      "typeVersion": 2.5
    },
    {
      "id": "dbe77304-ba70-49d7-81ee-3afffcae7820",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        420,
        560
      ],
      "webhookId": "20502d1a-b672-4e6d-ac2e-9c5f997ab1dc",
      "parameters": {
        "amount": 2
      },
      "typeVersion": 1.1
    },
    {
      "id": "34d5cbe7-2c3f-4bfd-888b-e0a4f81cd962",
      "name": "Editar campos3",
      "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": "Procesar por lotes",
      "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": {
          "id": "DQaiy0yJ0lNutzIl",
          "name": "BrightData account"
        }
      },
      "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": {
          "id": "DQaiy0yJ0lNutzIl",
          "name": "BrightData account"
        }
      },
      "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": "Dividir",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        360,
        240
      ],
      "parameters": {
        "options": {
          "destinationFieldName": "email"
        },
        "fieldToSplitOut": "emails"
      },
      "typeVersion": 1
    },
    {
      "id": "02b202cd-1a45-49a5-997a-35a692598f02",
      "name": "Filtrar",
      "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": "Agregar",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        660,
        240
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "a403ff04-ed4e-43f4-abd6-261173b7d63d",
      "name": "Código2",
      "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: [ 'sales@example.com', 'support@example.org', 'info@example.co.uk' ]\nreturn {emails}\n"
      },
      "typeVersion": 2
    },
    {
      "id": "4fd9ec2d-14e4-4765-bdad-1e33dd93d8c1",
      "name": "Dividir1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1280,
        720
      ],
      "parameters": {
        "options": {
          "destinationFieldName": "email"
        },
        "fieldToSplitOut": "emails"
      },
      "typeVersion": 1
    },
    {
      "id": "69e9a05d-9b30-409e-a94b-888828aa5dc1",
      "name": "Filtrar1",
      "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": "Agregar1",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1540,
        720
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "3f62b698-1948-45cf-bf70-467dd36e7c81",
      "name": "Nota adhesiva",
      "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": "Verificar si existe el correo",
      "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": "Extraer correos electrónicos",
      "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: [ 'sales@example.com', 'support@example.org', 'info@example.co.uk' ]\nreturn {emails}\n"
      },
      "typeVersion": 2
    },
    {
      "id": "43557ff1-642c-41b3-b6e9-cfc5de650428",
      "name": "Leer la base de datos",
      "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": {
          "id": "m6FHVVkUrN3xlE35",
          "name": "Postgres account"
        }
      },
      "typeVersion": 2.5
    },
    {
      "id": "5ae7d1e1-c626-4553-85c0-07c5f3ea96c6",
      "name": "Nota adhesiva1",
      "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": "Nota adhesiva2",
      "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": "Nota adhesiva3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1340,
        460
      ],
      "parameters": {
        "width": 960,
        "height": 540,
        "content": "## Read and iterate through the database\n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "a317567a-1d69-41b8-bab1-f656627381e4": {
      "main": [
        [
          {
            "node": "6daee671-8b07-4101-b57a-5dd7a9966c5e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "5fa56857-8607-430d-ac9e-0105f377cfbe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5fa56857-8607-430d-ac9e-0105f377cfbe": {
      "main": [
        [
          {
            "node": "e399a71c-46d2-4930-89a6-f976987ed3b3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "312ff218-353d-4d2c-a7e4-6a2bc133f828": {
      "main": [
        [
          {
            "node": "4da7a7a8-3eca-4f20-af2f-9fc0baf9b9b0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b79a33a6-3d15-44cf-b043-3e33cdb09cbf": {
      "main": [
        [
          {
            "node": "759cac41-3a78-499d-b529-8ae6f4bb51ea",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a403ff04-ed4e-43f4-abd6-261173b7d63d": {
      "main": [
        [
          {
            "node": "4fd9ec2d-14e4-4765-bdad-1e33dd93d8c1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e1ec0679-fde7-4a62-b162-dc3a6be50b8e": {
      "main": [
        [
          {
            "node": "a403ff04-ed4e-43f4-abd6-261173b7d63d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "dbe77304-ba70-49d7-81ee-3afffcae7820": {
      "main": [
        [
          {
            "node": "db49e284-72b4-41b7-8ca1-96335c46e11f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "02b202cd-1a45-49a5-997a-35a692598f02": {
      "main": [
        [
          {
            "node": "f15a901a-5225-4450-949b-6fb5769c6564",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e513e68c-9fe6-48e9-98c9-fd2787926619": {
      "main": [
        [
          {
            "node": "2a432d7a-cbe8-4334-b8c2-febfe5696c83",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "db49e284-72b4-41b7-8ca1-96335c46e11f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "4847e2e0-8abe-4d10-b04b-85b4ee318c83",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "69e9a05d-9b30-409e-a94b-888828aa5dc1": {
      "main": [
        [
          {
            "node": "6ec5cc13-8e67-43a7-bec3-81b8ba8121b7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e399a71c-46d2-4930-89a6-f976987ed3b3": {
      "main": [
        [
          {
            "node": "426cf1bc-f5e5-4f59-b727-b8baa5b715bb",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "00cfa54d-3776-4564-8a22-d15b27b8effe",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "00cfa54d-3776-4564-8a22-d15b27b8effe",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "4847e2e0-8abe-4d10-b04b-85b4ee318c83",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f15a901a-5225-4450-949b-6fb5769c6564": {
      "main": [
        [
          {
            "node": "30aa345b-90d1-4012-a3ba-81194ad676a1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6daee671-8b07-4101-b57a-5dd7a9966c5e": {
      "main": [
        [
          {
            "node": "b79a33a6-3d15-44cf-b043-3e33cdb09cbf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4847e2e0-8abe-4d10-b04b-85b4ee318c83": {
      "main": [
        [
          {
            "node": "b79a33a6-3d15-44cf-b043-3e33cdb09cbf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "426cf1bc-f5e5-4f59-b727-b8baa5b715bb": {
      "main": [
        [
          {
            "node": "b79a33a6-3d15-44cf-b043-3e33cdb09cbf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "00cfa54d-3776-4564-8a22-d15b27b8effe": {
      "main": [
        [
          {
            "node": "b79a33a6-3d15-44cf-b043-3e33cdb09cbf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ea68bca8-7f10-49d3-a14d-e46cc4c793ba": {
      "main": [
        [
          {
            "node": "02b202cd-1a45-49a5-997a-35a692598f02",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6ec5cc13-8e67-43a7-bec3-81b8ba8121b7": {
      "main": [
        [
          {
            "node": "34d5cbe7-2c3f-4bfd-888b-e0a4f81cd962",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2a432d7a-cbe8-4334-b8c2-febfe5696c83": {
      "main": [
        [
          {
            "node": "312ff218-353d-4d2c-a7e4-6a2bc133f828",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4fd9ec2d-14e4-4765-bdad-1e33dd93d8c1": {
      "main": [
        [
          {
            "node": "69e9a05d-9b30-409e-a94b-888828aa5dc1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "db49e284-72b4-41b7-8ca1-96335c46e11f": {
      "main": [
        [
          {
            "node": "e1ec0679-fde7-4a62-b162-dc3a6be50b8e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "34d5cbe7-2c3f-4bfd-888b-e0a4f81cd962": {
      "main": [
        [
          {
            "node": "a317567a-1d69-41b8-bab1-f656627381e4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4da7a7a8-3eca-4f20-af2f-9fc0baf9b9b0": {
      "main": [
        [
          {
            "node": "ea68bca8-7f10-49d3-a14d-e46cc4c793ba",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "759cac41-3a78-499d-b529-8ae6f4bb51ea": {
      "main": [
        [],
        [
          {
            "node": "e513e68c-9fe6-48e9-98c9-fd2787926619",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b4e9b540-49f4-48d5-abf9-5008412a86bc": {
      "main": [
        [
          {
            "node": "43557ff1-642c-41b3-b6e9-cfc5de650428",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "43557ff1-642c-41b3-b6e9-cfc5de650428": {
      "main": [
        [
          {
            "node": "759cac41-3a78-499d-b529-8ae6f4bb51ea",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "30aa345b-90d1-4012-a3ba-81194ad676a1": {
      "main": [
        [
          {
            "node": "6daee671-8b07-4101-b57a-5dd7a9966c5e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "dbe77304-ba70-49d7-81ee-3afffcae7820",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "45b55e87-08a0-44e5-a220-5d9110ac364e": {
      "main": [
        [
          {
            "node": "43557ff1-642c-41b3-b6e9-cfc5de650428",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Avanzado - Ventas, Inteligencia Artificial, Marketing

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Avanzado
Número de nodos32
Categoría3
Tipos de nodos15
Descripción de la dificultad

Adecuado para usuarios avanzados, flujos de trabajo complejos con 16+ nodos

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34