{
  "id": "GuvmMG7ssyd4Gy4z",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Ecommerce Leads Finder & Contact Extraction",
  "tags": [],
  "nodes": [
    {
      "id": "4ecda2bf-d244-421f-be72-91a4012cdc97",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -3184,
        2032
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "7323cbbc-bf44-49aa-ba21-f61bcb4072a7",
      "name": "Check Cached Product Detail Result",
      "type": "n8n-nodes-base.code",
      "position": [
        -2080,
        2032
      ],
      "parameters": {
        "jsCode": "const raw_data = $input.all();\n\nconst cutoffTime = new Date();\ncutoffTime.setHours(1, 30, 0, 0);\n\n// Process a single item\nasync function processItem(data) {\n    const item = data.json;\n    console.log(\"item\", item)\n    const url = item.Url;\n    console.log(\"url\", url)\n    const scraperId = \"1780b8cb-747e-46b8-8d0d-b0168aeea930\";\n\n    const response = await this.helpers.httpRequest({\n        method: 'GET',\n        url: `https://api.app.mrscraper.com/api/v1/results?filters[url]=${encodeURIComponent(url)}&page=1&pageSize=1&sort=createdAt&sortOrder=DESC&filters[scraperId]=${scraperId}`,\n        headers: {\n            'accept': 'application/json',\n            'x-api-token': '',\n        },\n    });\n    console.log(\"response\", response)\n    let found = false;\n    let cur_result = null;\n    let last_scraped_at = null;\n\n    const results = response?.data || [];\n    for (let result of results) {\n\n        // Handle \"too large data\" case\n        if (result?.data?.message === \"Data is too large to display, check dataPath for more details\") {\n            const response_detail = await this.helpers.httpRequest({\n                method: 'GET',\n                url: `https://api.app.mrscraper.com/api/v1/results/${result.id}`,\n                headers: {\n                    'accept': 'application/json',\n                    'x-api-token': '',\n                },\n            });\n\n            result = response_detail?.data || results;\n        }\n        console.log(\"result\", result)\n        const createdAt = new Date(result.createdAt);\n\n        const title = result?.data?.Detail_product?.title;\n\n        if (title) {\n            found = true;\n            cur_result = result;\n            break;\n        }\n\n        // track last scraped date\n        if (!last_scraped_at || createdAt > new Date(last_scraped_at)) {\n            last_scraped_at = createdAt.toISOString().split('T')[0];\n        }\n    }\n\n    // If the item is new, return the original item from previous node\n    return {\n        is_new: !found,\n        data: found ? cur_result.data : item, // <-- use item when new\n    };\n}\n\n// Process with parallel workers\nconst WORKERS = 10;\nlet output = [];\n\nfor (let i = 0; i < raw_data.length; i += WORKERS) {\n    const chunk = raw_data.slice(i, i + WORKERS);\n\n    const results = await Promise.all(\n        chunk.map(data => processItem.call(this, data))\n    );\n\n    output.push(...results);\n}\n\nreturn output;"
      },
      "retryOnFail": true,
      "typeVersion": 2,
      "waitBetweenTries": 5000
    },
    {
      "id": "fde2dc17-d766-4a4d-bf02-1f74d04b6290",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        144,
        544
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "ee381b2c-ca25-45ef-a1e6-01c54d00386a",
      "name": "Check Cached Result Contact Detail1",
      "type": "n8n-nodes-base.code",
      "position": [
        224,
        -384
      ],
      "parameters": {
        "jsCode": "const raw_data = $input.all();\n\nconst cutoffTime = new Date();\ncutoffTime.setHours(1, 30, 0, 0);\n\n// Process a single item\nasync function processItem(data) {\n    const item = data.json;\n    const url = item.contact_url;\n\n    if (!url) {\n        return {\n            is_new: true,\n            data: item,\n        };\n    }\n\n    const scraperId = \"66e9c8ad-9d8a-47a2-b855-20aa13e64c66\";\n\n    const response = await this.helpers.httpRequest({\n        method: 'GET',\n        url: `https://api.app.mrscraper.com/api/v1/results?filters[url]=${encodeURIComponent(url)}&page=1&pageSize=1&sort=createdAt&sortOrder=DESC&filters[scraperId]=${scraperId}`,\n        headers: {\n            'accept': 'application/json',\n            'x-api-token': 'YOUR_MRSCRAPER_API_TOKEN',\n        },\n    });\n\n    let found = false;\n    let cur_result = null;\n    let last_scraped_at = null;\n\n    const results = response?.data || [];\n\n    for (let result of results) {\n\n        if (result?.data?.message === \"Data is too large to display, check dataPath for more details\") {\n            const response_detail = await this.helpers.httpRequest({\n                method: 'GET',\n                url: `https://api.app.mrscraper.com/api/v1/results/${result.id}`,\n                headers: {\n                    'accept': 'application/json',\n                    'x-api-token': 'YOUR_MRSCRAPER_API_TOKEN',\n                },\n            });\n\n            result = response_detail?.data || result;\n        }\n\n        const createdAt = new Date(result.createdAt);\n\n        const dataResult = result?.data?.data ?? result?.data;\n        const email = dataResult?.emails;\n\n        if (email) {\n            found = true;\n            cur_result = dataResult;\n            break;\n        }\n\n        // track last scraped date\n        if (!last_scraped_at || createdAt > new Date(last_scraped_at)) {\n            last_scraped_at = createdAt.toISOString().split('T')[0];\n        }\n    }\n\n    return {\n        is_new: !found,\n        data: found ? cur_result : item,\n    };\n}\n\n// Process with parallel workers\nconst WORKERS = 10;\nlet output = [];\n\nfor (let i = 0; i < raw_data.length; i += WORKERS) {\n    const chunk = raw_data.slice(i, i + WORKERS);\n\n    const results = await Promise.all(\n        chunk.map(data => processItem.call(this, data))\n    );\n\n    output.push(...results);\n}\n\nreturn output;"
      },
      "retryOnFail": true,
      "typeVersion": 2,
      "waitBetweenTries": 5000
    },
    {
      "id": "5622e7af-df68-4cc5-bd78-e216f3837d42",
      "name": "Run if only one execution exists",
      "type": "n8n-nodes-base.if",
      "position": [
        -2736,
        2032
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "16029302-62e1-4ccd-8e66-6c7ac00bee3d",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $json.runningCount }}",
              "rightValue": 1
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "bc8d3041-30e8-40d9-bffc-8108b1c489e9",
      "name": "Get Product url",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -2528,
        2032
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_PRODUCT_URL_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_PRODUCT_URL_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_PRODUCT_URL_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Spedire Detail Url"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "30d01806-ddda-4bda-bc8d-07eb1e672a7e",
      "name": "Loop Over Product Url",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -2304,
        2032
      ],
      "parameters": {
        "options": {},
        "batchSize": 100
      },
      "typeVersion": 3
    },
    {
      "id": "aeba7e42-54a6-4ebb-bca1-d08630803809",
      "name": "Check is New or Cached is available",
      "type": "n8n-nodes-base.if",
      "position": [
        -1856,
        2032
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "2f1ef202-e090-478d-9cc3-2d57d3571bd1",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.is_new }}",
              "rightValue": {}
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "eae8669d-3fcb-4fe0-8e0d-ccfe1656df5f",
      "name": "Run Detail Product Scraper",
      "type": "n8n-nodes-mrscraper.mrscraper",
      "onError": "continueRegularOutput",
      "position": [
        -1632,
        1952
      ],
      "parameters": {
        "url": "={{ $json.data.Url ?? $json.data.Detail_product.url }}",
        "scraperId": "YOUR SCRAPER ID",
        "requestOptions": {
          "timeout": 120000
        }
      },
      "credentials": {
        "mrscraperApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "4f7c8c24-2735-4f1f-82d7-5561a3835a33",
      "name": "Merge Product Detail Data",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1408,
        2032
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "1721297c-50cf-4cf4-98b9-60a5f29ba8ea",
      "name": "Formatting Data",
      "type": "n8n-nodes-base.code",
      "position": [
        -1120,
        2016
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\nreturn items.map((item) => {\n  const raw = item.json ?? {};\n\n  // support both structures\n  // data 1 => raw.data.data\n  // data 2 => raw.data\n  const root =\n    raw?.data?.data ||\n    raw?.data ||\n    {};\n\n  const product =\n    root?.Detail_product ??\n    null;\n\n  const seller =\n    root?.Detail_seller?.data ??\n    root?.Detail_seller ??\n    null;\n\n  return {\n    json: {\n      // PRODUCT\n      url: product?.url ?? null,\n\n      productTitle: product?.title ?? null,\n      productSummary: product?.aiSummary ?? null,\n      productDescription: product?.description ?? null,\n\n      favoritesCount: product?.favoritesCount ?? null,\n\n      // SPECIFICATIONS\n      specEra:\n        product?.specifications?.Era ?? null,\n\n      specBrand:\n        product?.specifications?.Brand ?? null,\n\n      specModel:\n        product?.specifications?.Model ||\n        product?.specifications?.[\"Model/name\"] ||\n        null,\n\n      specArtist:\n        product?.specifications?.Artist ?? null,\n\n      specDesigner:\n        product?.specifications?.[\"Designer/artist/maker\"] ?? null,\n\n      specManufacturer:\n        product?.specifications?.[\"Manufacturer/brand\"] ?? null,\n\n      specCountryOrigin:\n        product?.specifications?.[\"Country of origin\"] ?? null,\n\n      specMaterial:\n        product?.specifications?.Material ?? null,\n\n      specStyle:\n        product?.specifications?.Style ?? null,\n\n      specColour:\n        product?.specifications?.Colour ?? null,\n\n      specCondition:\n        product?.specifications?.Condition ?? null,\n\n      specPeriod:\n        product?.specifications?.Period ?? null,\n\n      specYear:\n        product?.specifications?.Year ?? null,\n\n      specTechnique:\n        product?.specifications?.Technique ?? null,\n\n      specSignature:\n        product?.specifications?.Signature ?? null,\n\n      specEdition:\n        product?.specifications?.Edition ?? null,\n\n      specSoldBy:\n        product?.specifications?.[\"Sold by\"] ?? null,\n\n      specSoldWithFrame:\n        product?.specifications?.[\"Sold with frame\"] ?? null,\n\n      specTitleArtwork:\n        product?.specifications?.[\"Title of artwork\"] ?? null,\n\n      specEstPeriod:\n        product?.specifications?.[\"Estimated period\"] ?? null,\n\n      specHeight:\n        product?.specifications?.Height ?? null,\n\n      specWidth:\n        product?.specifications?.Width ?? null,\n\n      specDepth:\n        product?.specifications?.Depth ?? null,\n\n      specSeatingHeight:\n        product?.specifications?.[\"Seating height\"] ?? null,\n\n      specNumObjects:\n        product?.specifications?.[\"Number of objects\"] ?? null,\n\n      // SHIPPING\n      shippingDestination:\n        product?.shipping?.destination ?? null,\n\n      shippingCost:\n        product?.shipping?.cost ?? null,\n\n      pickupLocation:\n        product?.shipping?.pickupLocation ?? null,\n\n      // IMAGES\n      imageUrls: (product?.images ?? [])\n        .map(img => img?.url)\n        .filter(Boolean)\n        .join(\" | \") || null,\n\n      imageAlts: (product?.images ?? [])\n        .map(img => img?.alt)\n        .filter(Boolean)\n        .join(\" | \") || null,\n\n      // SELLER (FROM PRODUCT)\n      sellerName:\n        product?.seller?.name ?? null,\n\n      sellerProfileUrl:\n        product?.seller?.profileUrl ?? null,\n\n      sellerCountry: seller?.country ??\n        product?.seller?.country ??  null,\n\n      sellerVerified:\n        product?.seller?.verified ?? null,\n\n      sellerType:\n        product?.seller?.type ?? null,\n\n      sellerObjectsSold:\n        product?.seller?.stats?.[\"Objects sold\"] ?? null,\n\n      sellerReviews:\n        product?.seller?.stats?.[\"Reviews\"] ?? null,\n\n      sellerPositiveScore:\n        product?.seller?.stats?.[\"100%\"] ?? null,\n\n      // SELLER DETAIL\n      sellerId:\n        seller?.sellerId ?? null,\n\n      seller_page_url:\n        seller?.sellerUrl ?? null,\n\n      sellerCanonicalUrl:\n        seller?.canonicalUrl ?? null,\n\n      sellerDetailCountry:\n        seller?.country ?? null,\n\n      business_name:\n        seller?.businessName ?? null,\n\n      business_address:\n        seller?.businessAddress ?? null,\n\n      business_license_number:\n        seller?.businessRegNumber ?? null,\n\n      sellerReviewCount:\n        seller?.reviewCount ?? null,\n\n      sellerObjectsSoldDetail:\n        seller?.objectsSold ?? null,\n\n      sellerPositiveScoreDetail:\n        seller?.positiveScore ?? null,\n\n      reviewsUrl:\n        seller?.reviewsUrl ?? null,\n\n      sellerTags: (seller?.tags ?? [])\n        .filter(Boolean)\n        .join(\" | \") || null,\n\n      sellerLotLabels: (seller?.lots ?? [])\n        .map(l => l?.label)\n        .filter(Boolean)\n        .join(\" | \") || null,\n\n      sellerLotCounts: (seller?.lots ?? [])\n        .map(l => l?.count)\n        .filter(v => v !== undefined && v !== null)\n        .join(\" | \") || null,\n\n      sellerLotUrls: (seller?.lots ?? [])\n        .map(l => l?.url)\n        .filter(Boolean)\n        .join(\" | \") || null,\n    },\n  };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "055b6927-38e2-4e44-b3e4-205ab04766da",
      "name": "Append or update Product Detail in Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -928,
        2016
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "contact_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "contact_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "company_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "company_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productTitle",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "productTitle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productSummary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "productSummary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productDescription",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "productDescription",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "favoritesCount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "favoritesCount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specEra",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specEra",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specModel",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specModel",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specDesigner",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specDesigner",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specManufacturer",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specManufacturer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specCountryOrigin",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specCountryOrigin",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specMaterial",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specMaterial",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specStyle",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specStyle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specColour",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specColour",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specCondition",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specCondition",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specEstPeriod",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specEstPeriod",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specHeight",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specHeight",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specWidth",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specWidth",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specDepth",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specDepth",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specSeatingHeight",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specSeatingHeight",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specNumObjects",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "specNumObjects",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "shippingDestination",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "shippingDestination",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "shippingCost",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "shippingCost",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickupLocation",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "pickupLocation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "imageUrls",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "imageUrls",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "imageAlts",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "imageAlts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerName",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "sellerName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seller_page_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "seller_page_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "business_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "business_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_license_number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "business_license_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerProfileUrl",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "sellerProfileUrl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerCountry",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "sellerCountry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerVerified",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "sellerVerified",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerType",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "sellerType",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerObjectsSold",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "sellerObjectsSold",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerReviews",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "sellerReviews",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerDetailCountry",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "sellerDetailCountry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotLabels",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "sellerLotLabels",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotCounts",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "sellerLotCounts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotUrls",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "sellerLotUrls",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "emails",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "emails",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phones",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "phones",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [
            "url"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_LEADS_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Spedire Leads"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "9b4ca6ab-a0af-4a18-a4c2-557a4535920b",
      "name": "Append or update url's scraped status",
      "type": "n8n-nodes-base.googleSheets",
      "onError": "continueRegularOutput",
      "position": [
        -736,
        2016
      ],
      "parameters": {
        "columns": {
          "value": {
            "Url": "={{ $json.url }}",
            "status": "finished"
          },
          "schema": [
            {
              "id": "Url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Url"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_PRODUCT_URL_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_PRODUCT_URL_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_PRODUCT_URL_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Spedire Detail Url"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "a8565e90-2853-48e5-8832-01a6608e0e73",
      "name": "Loop SERP Company URL by Seller Detail",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1680,
        1248
      ],
      "parameters": {
        "options": {},
        "batchSize": 500
      },
      "typeVersion": 3
    },
    {
      "id": "9338b2e3-7bc4-4c8e-b856-6780abc9d71b",
      "name": "Get sellerDetail filter by Seller Country",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1904,
        1248
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "Italy",
              "lookupColumn": "sellerCountry"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_LEADS_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Spedire Leads"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.7
    },
    {
      "id": "b7eab9b1-6f1d-46e7-99cb-0e1986ed788e",
      "name": "request SERP API",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        -1232,
        1168
      ],
      "parameters": {
        "url": "https://sync.scraper.mrscraper.com/api/google/serp/sync",
        "method": "POST",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "jsonBody": "={\n  \"url\": \"https://www.google.com/search?q={{ $json.business_name ?? $json.sellerName }}+{{ $json.sellerCountry }}\",\n  \"raw\": true\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            },
            {
              "name": "Cookie",
              "value": "sl-session=YOUR_SESSION_COOKIE;"
            },
            {
              "name": "cookie",
              "value": "sl-session=YOUR_SESSION_COOKIE;"
            }
          ]
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "16e2c689-dbf8-430f-a3a5-77086e29f222",
      "name": "Filter Legit Company Profile Url",
      "type": "n8n-nodes-base.code",
      "position": [
        -1008,
        1168
      ],
      "parameters": {
        "jsCode": "const allInputs = $input.all();\nconst allScraperItems = $('Filter License Exists & Company URL Not Yet Available').all(0) ?? null;\nconsole.log(\"allScraperItems\", allScraperItems)\n\nconst BLACKLIST = [\n  'facebook.com','instagram.com','linkedin.com','twitter.com','x.com',\n  'youtube.com','tiktok.com','reddit.com','pinterest.com','threads.net',\n  'amazon.com','amazon.it','amazon.co.uk','amazon.de',\n  'ebay.com','ebay.it','etsy.com','aliexpress.com','alibaba.com',\n  'catawiki.com','vinted.com','subito.it','yelp.com','tripadvisor.com',\n  'trustpilot.com','wikipedia.org','google.com','bing.com','crunchbase.com'\n];\n\nconst CONFIDENCE_THRESHOLD = 2.5;\n\n\nfunction normalize(text) {\n  return (text || '')\n    .toLowerCase()\n    .replace(/[^a-z0-9\\s]+/g, ' ');\n}\n\nfunction tokenize(name) {\n  const stopwords = new Set([\n    \"the\",\"and\",\"of\",\"di\",\"e\",\"srl\",\"sas\",\"spa\",\"sa\",\"ltd\",\"llc\",\n    \"inc\",\"co\",\"company\",\"corp\",\"group\",\"holding\",\"holdings\"\n  ]);\n\n  return normalize(name)\n    .split(/\\s+/)\n    .filter(t => t && !stopwords.has(t) && t.length > 1);\n}\n\nfunction extractDomain(url) {\n  let d = url.replace(/^https?:\\/\\//i, '');\n  d = d.replace(/^www\\./i, '');\n  return d.split('/')[0].toLowerCase();\n}\n\nfunction registrableDomain(host) {\n  host = host.replace(/^www\\./, '');\n  const parts = host.split('.');\n  if (parts.length <= 2) return host;\n  return parts.slice(-2).join('.');\n}\n\nfunction isBlacklisted(url) {\n  const d = extractDomain(url);\n  return BLACKLIST.some(b => d === b || d.endsWith('.' + b));\n}\n\nfunction scoreCandidate(item, tokens, country) {\n  let score = 0;\n\n  const url = item.url;\n  const title = item.title || '';\n  const snippet = item.snippet || '';\n  const rank = item.rank ?? 0;\n\n  const parsedDomain = extractDomain(url);\n  const domain = registrableDomain(parsedDomain);\n\n  const domainCore = domain.split('.')[0];\n  const domainCompact = domainCore.replace(/[^a-z0-9]/g, '');\n\n  const tokenSet = new Set(tokens);\n  const domainTokens = domainCore.split(/[^a-z0-9]+/).filter(Boolean);\n\n  // 1. DOMAIN TOKEN MATCH (3.0)\n  const domainHits = domainTokens.filter(t => tokenSet.has(t)).length;\n  score += 3.0 * domainHits;\n\n  // 2. SUBSTRING MATCH (1.5)\n  let substringHits = 0;\n  for (const t of tokens) {\n    if (t.length >= 3 && domainCompact.includes(t)) substringHits++;\n  }\n  score += 1.5 * Math.max(0, substringHits - domainHits);\n\n  // 3. FULL NAME MATCH (2.0)\n  const joined = tokens.join('');\n  if (joined && domainCompact.includes(joined)) {\n    score += 2.0;\n  }\n\n  // 4. TITLE + SNIPPET MATCH (0.4)\n  const haystack = normalize(title + ' ' + snippet);\n  let textHits = 0;\n  for (const t of tokenSet) {\n    if (haystack.includes(t)) textHits++;\n  }\n  score += 0.4 * textHits;\n\n  // 5. HOMEPAGE BONUS (0.5)\n  const path = url.split(parsedDomain)[1] || '';\n  if (!path || path === '/') score += 0.5;\n  else if (path.split('/').length > 3) score -= 0.3;\n\n  // 6. RANK BONUS (0.3 decay)\n  score += Math.max(0, 0.3 - 0.03 * rank);\n\n  // 7. BLOG / BUILDER PENALTY (-1.5)\n  if (\n    parsedDomain.includes('blogspot') ||\n    parsedDomain.includes('wordpress') ||\n    parsedDomain.includes('wixsite') ||\n    parsedDomain.includes('weebly')\n  ) {\n    score -= 1.5;\n  }\n\n  return score;\n}\n\nfunction process(inputItem, scraperItem) {\n  const inputJson = inputItem?.json ?? null;\n  const scraperJson = scraperItem?.json ?? null;\n\n  const searchResults = Array.isArray(inputJson)\n    ? (inputJson[0]?.data ?? inputJson)\n    : (inputJson?.data ?? []);\n\n  const filtered = searchResults.filter(r => !isBlacklisted(r.url || ''));\n\n  const businessName =\n    scraperJson?.business_name ||\n    scraperJson?.data?.name ||\n    '';\n  console.log(\"businessName\", businessName)\n  const tokens = tokenize(businessName);\n\n  let bestScore = -Infinity;\n  let bestUrl = null;\n\n  const scored = filtered.map(r => {\n    const score = scoreCandidate(r, tokens);\n    return { ...r, score };\n  });\n\n  for (const r of scored) {\n    if (r.score > bestScore) {\n      bestScore = r.score;\n      bestUrl = r.url;\n    }\n  }\n\n  return {\n    bestUrl: bestScore >= CONFIDENCE_THRESHOLD ? bestUrl : null,\n    score: bestScore,\n    threshold: CONFIDENCE_THRESHOLD,\n    passed: bestScore >= CONFIDENCE_THRESHOLD,\n    businessName,\n    ranked: scored.sort((a,b) => b.score - a.score)\n  };\n}\n\n// Main Code\nreturn allInputs.map((inputItem, i) => {\n  const scraperItem = allScraperItems[i] ?? allScraperItems.at(-1);\n  return { json: process(inputItem, scraperItem) };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "f74ad874-a135-4b6b-bd3f-e3202ccdd59b",
      "name": "Append or update company Url",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -784,
        1168
      ],
      "parameters": {
        "columns": {
          "value": {
            "url": "={{ $('Filter License Exists & Company URL Not Yet Available').item.json.url }}",
            "company_url": "={{ $json.bestUrl }}"
          },
          "schema": [
            {
              "id": "url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "contact_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "contact_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "company_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "company_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productTitle",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "productTitle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productSummary",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "productSummary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productDescription",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "productDescription",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "favoritesCount",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "favoritesCount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specEra",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specEra",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specModel",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specModel",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specDesigner",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specDesigner",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specManufacturer",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specManufacturer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specCountryOrigin",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specCountryOrigin",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specMaterial",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specMaterial",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specStyle",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specStyle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specColour",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specColour",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specCondition",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specCondition",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specEstPeriod",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specEstPeriod",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specHeight",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specHeight",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specWidth",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specWidth",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specDepth",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specDepth",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specSeatingHeight",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specSeatingHeight",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specNumObjects",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specNumObjects",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "shippingDestination",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "shippingDestination",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "shippingCost",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "shippingCost",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickupLocation",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "pickupLocation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "imageUrls",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "imageUrls",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "imageAlts",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "imageAlts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerName",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seller_page_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "seller_page_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_license_number",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_license_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerProfileUrl",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerProfileUrl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerCountry",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerCountry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerVerified",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerVerified",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerType",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerType",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerObjectsSold",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerObjectsSold",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerReviews",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerReviews",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerDetailCountry",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerDetailCountry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotLabels",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerLotLabels",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotCounts",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerLotCounts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotUrls",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerLotUrls",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "emails",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "emails",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phones",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "phones",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "url"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_LEADS_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Spedire Leads"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "5a2e1900-ffe0-4670-9308-f33c52913bb3",
      "name": "Merge Serp Result",
      "type": "n8n-nodes-base.merge",
      "onError": "continueRegularOutput",
      "position": [
        -544,
        1248
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "ceab6bbc-1920-4d76-9e46-fa8ac6259e47",
      "name": "Append or update row in Contact Url",
      "type": "n8n-nodes-base.googleSheets",
      "onError": "continueRegularOutput",
      "position": [
        -80,
        464
      ],
      "parameters": {
        "columns": {
          "value": {
            "url": "={{ $('Filter Company Url Exists & Contact Url Not Yet Available').item.json.url }}",
            "contact_url": "={{ $json.url }}"
          },
          "schema": [
            {
              "id": "url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "contact_url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "contact_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "company_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "company_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productTitle",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "productTitle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productSummary",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "productSummary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productDescription",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "productDescription",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "favoritesCount",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "favoritesCount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specEra",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specEra",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specModel",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specModel",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specDesigner",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specDesigner",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specManufacturer",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specManufacturer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specCountryOrigin",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specCountryOrigin",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specMaterial",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specMaterial",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specStyle",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specStyle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specColour",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specColour",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specCondition",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specCondition",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specEstPeriod",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specEstPeriod",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specHeight",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specHeight",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specWidth",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specWidth",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specDepth",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specDepth",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specSeatingHeight",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specSeatingHeight",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specNumObjects",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specNumObjects",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "shippingDestination",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "shippingDestination",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "shippingCost",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "shippingCost",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickupLocation",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "pickupLocation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "imageUrls",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "imageUrls",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "imageAlts",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "imageAlts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerName",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seller_page_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "seller_page_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_license_number",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_license_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerProfileUrl",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerProfileUrl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerCountry",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerCountry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerVerified",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerVerified",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerType",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerType",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerObjectsSold",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerObjectsSold",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerReviews",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerReviews",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerDetailCountry",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerDetailCountry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotLabels",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerLotLabels",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotCounts",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerLotCounts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotUrls",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerLotUrls",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "emails",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "emails",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phones",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "phones",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specBrand",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specBrand",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specArtist",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specArtist",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specPeriod",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specPeriod",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specYear",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specYear",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specTechnique",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specTechnique",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specSignature",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specSignature",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specEdition",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specEdition",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specSoldBy",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specSoldBy",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specSoldWithFrame",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specSoldWithFrame",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specTitleArtwork",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specTitleArtwork",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerPositiveScore",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerPositiveScore",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerId",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerCanonicalUrl",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerCanonicalUrl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerReviewCount",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerReviewCount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerObjectsSoldDetail",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerObjectsSoldDetail",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerPositiveScoreDetail",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerPositiveScoreDetail",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "reviewsUrl",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "reviewsUrl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerTags",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerTags",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "url"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_PRODUCT_URL_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_LEADS_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Spedire Leads"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "8ced8950-5852-4ce7-92b3-ec6b9a0877a8",
      "name": "Run Contact Url Scraper",
      "type": "n8n-nodes-mrscraper.mrscraper",
      "onError": "continueRegularOutput",
      "position": [
        -544,
        464
      ],
      "parameters": {
        "url": "={{ $json.company_url }}",
        "scraperId": "{Your Scraper ID}",
        "requestOptions": {
          "timeout": 120000
        }
      },
      "credentials": {
        "mrscraperApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "6c9a18b5-699a-4f23-b90e-3165c114fde9",
      "name": "Flatten Data",
      "type": "n8n-nodes-base.code",
      "position": [
        -320,
        464
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\nconst result = items.map(item => {\n  let urls =\n    item.json?.data?.data?.data ?? // format scraper\n    item.json?.data ??             // format simple\n    null;\n\n  // kalau string -> ubah jadi array\n  if (typeof urls === \"string\") {\n    urls = [urls];\n  }\n\n  // fallback null\n  if (!Array.isArray(urls) || urls.length === 0) {\n    return { json: { url: null } };\n  }\n\n  // sorting priority:\n  // 1. yang punya slash lebih banyak\n  // 2. kalau sama, string paling panjang\n  // 3. kalau masih sama, ambil index pertama\n  const bestUrl = urls.reduce((best, current) => {\n    if (!best) return current;\n\n    const bestSlash = (best.match(/\\//g) || []).length;\n    const currentSlash = (current.match(/\\//g) || []).length;\n\n    // prioritas slash lebih banyak\n    if (currentSlash > bestSlash) {\n      return current;\n    }\n\n    // kalau slash sama -> ambil string lebih panjang\n    if (\n      currentSlash === bestSlash &&\n      current.length > best.length\n    ) {\n      return current;\n    }\n\n    return best;\n  }, null);\n\n  return {\n    json: {\n      url: bestUrl\n    }\n  };\n});\n\nreturn result;"
      },
      "typeVersion": 2
    },
    {
      "id": "38251da7-28e7-41a4-b401-f383a227d739",
      "name": "Get row(s) Company Url filterBy sellerCountry",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1232,
        544
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "Italy",
              "lookupColumn": "sellerCountry"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_LEADS_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Spedire Leads"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "90007a55-6af5-4148-884f-fe65a43b0864",
      "name": "Get ContactUrl",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -448,
        -272
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "Italy",
              "lookupColumn": "sellerCountry"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_LEADS_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Spedire Leads"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "78db6f70-9bb8-464e-be81-675a8f042e81",
      "name": "Loop Scrape ContactUrl",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1008,
        544
      ],
      "parameters": {
        "options": {},
        "batchSize": 300
      },
      "typeVersion": 3
    },
    {
      "id": "c8207ebb-f1d8-4a1c-b515-7d17fe975095",
      "name": "Filter License Exists & Company URL Not Yet Available",
      "type": "n8n-nodes-base.if",
      "onError": "continueRegularOutput",
      "position": [
        -1456,
        1248
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "48c955db-d74f-4040-ba86-0afe70473305",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.business_license_number }}",
              "rightValue": ""
            },
            {
              "id": "9d275bb4-c945-406a-82cb-3e1d67465648",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.company_url }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "299be6d5-f4a3-4c64-bd80-5913eec30aa3",
      "name": "Filter Company Url Exists & Contact Url Not Yet Available",
      "type": "n8n-nodes-base.if",
      "position": [
        -784,
        544
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0928d204-ea1b-472d-9d6f-f34e5eef7385",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.company_url }}",
              "rightValue": ""
            },
            {
              "id": "a444977c-10d5-4ee6-9e2a-0a1331676ce7",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.contact_url }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "a012f93f-794f-4771-b11b-2eae3b7d2999",
      "name": "Loop Scrape Detail Contact",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -224,
        -272
      ],
      "parameters": {
        "options": {},
        "batchSize": 500
      },
      "typeVersion": 3
    },
    {
      "id": "21bec875-e178-47bb-a630-f177ada0dfbc",
      "name": "Filter Contact Url Exists & Contact Not Yet Available",
      "type": "n8n-nodes-base.if",
      "position": [
        0,
        -336
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fce5ff30-f211-447f-a189-ead7e5aeec2a",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.phones }}",
              "rightValue": ""
            },
            {
              "id": "5e140984-9a49-42fe-a004-5ec6965777a7",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.contact_url }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "30164d7a-9e77-4674-addc-4c3963265e22",
      "name": "Run Contact Detail Scraper",
      "type": "n8n-nodes-mrscraper.mrscraper",
      "onError": "continueRegularOutput",
      "position": [
        688,
        -480
      ],
      "parameters": {
        "url": "={{ $json.data.contact_url }}",
        "scraperId": "{Your Scraper ID}",
        "requestOptions": {
          "timeout": 120000
        }
      },
      "credentials": {
        "mrscraperApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "86fae2b8-8a43-4397-845a-5ba78530fd99",
      "name": "Append or update Contact Detail",
      "type": "n8n-nodes-base.googleSheets",
      "onError": "continueRegularOutput",
      "position": [
        896,
        -288
      ],
      "parameters": {
        "columns": {
          "value": {
            "url": "={{ $('Filter Contact Url Exists & Contact Not Yet Available').all()[0].json.url }}",
            "emails": "={{ $json.data.emails }}",
            "phones": "={{ $json.data.phones }}"
          },
          "schema": [
            {
              "id": "url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "contact_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "contact_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "company_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "company_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productTitle",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "productTitle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productSummary",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "productSummary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productDescription",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "productDescription",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "favoritesCount",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "favoritesCount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specEra",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specEra",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specModel",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specModel",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specDesigner",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specDesigner",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specManufacturer",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specManufacturer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specCountryOrigin",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specCountryOrigin",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specMaterial",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specMaterial",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specStyle",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specStyle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specColour",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specColour",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specCondition",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specCondition",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specEstPeriod",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specEstPeriod",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specHeight",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specHeight",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specWidth",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specWidth",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specDepth",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specDepth",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specSeatingHeight",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specSeatingHeight",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specNumObjects",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specNumObjects",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "shippingDestination",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "shippingDestination",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "shippingCost",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "shippingCost",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickupLocation",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "pickupLocation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "imageUrls",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "imageUrls",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "imageAlts",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "imageAlts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerName",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seller_page_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "seller_page_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_license_number",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_license_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerProfileUrl",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerProfileUrl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerCountry",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerCountry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerVerified",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerVerified",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerType",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerType",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerObjectsSold",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerObjectsSold",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerReviews",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerReviews",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerDetailCountry",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerDetailCountry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotLabels",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerLotLabels",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotCounts",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerLotCounts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotUrls",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerLotUrls",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "emails",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "emails",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phones",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "phones",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "url"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_PRODUCT_URL_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_LEADS_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Spedire Leads"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "81d7dd14-9b59-4fb7-9ea8-8515b2d18e6b",
      "name": "Append or update Contact Detail1",
      "type": "n8n-nodes-base.googleSheets",
      "onError": "continueRegularOutput",
      "position": [
        912,
        -480
      ],
      "parameters": {
        "columns": {
          "value": {
            "url": "={{ $('Filter Contact Url Exists & Contact Not Yet Available').all()[0].json.url }}",
            "emails": "={{ $json.data.data.data.emails }}",
            "phones": "={{ $json.data.data.data.phones }}"
          },
          "schema": [
            {
              "id": "url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "contact_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "contact_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "company_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "company_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productTitle",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "productTitle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productSummary",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "productSummary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productDescription",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "productDescription",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "favoritesCount",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "favoritesCount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specEra",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specEra",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specModel",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specModel",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specDesigner",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specDesigner",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specManufacturer",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specManufacturer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specCountryOrigin",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specCountryOrigin",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specMaterial",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specMaterial",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specStyle",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specStyle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specColour",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specColour",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specCondition",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specCondition",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specEstPeriod",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specEstPeriod",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specHeight",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specHeight",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specWidth",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specWidth",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specDepth",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specDepth",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specSeatingHeight",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specSeatingHeight",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "specNumObjects",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "specNumObjects",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "shippingDestination",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "shippingDestination",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "shippingCost",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "shippingCost",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pickupLocation",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "pickupLocation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "imageUrls",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "imageUrls",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "imageAlts",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "imageAlts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerName",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seller_page_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "seller_page_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_license_number",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_license_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerProfileUrl",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerProfileUrl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerCountry",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerCountry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerVerified",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerVerified",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerType",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerType",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerObjectsSold",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerObjectsSold",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerReviews",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerReviews",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerDetailCountry",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerDetailCountry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotLabels",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerLotLabels",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotCounts",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerLotCounts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sellerLotUrls",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "sellerLotUrls",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "emails",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "emails",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phones",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "phones",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "url"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_PRODUCT_URL_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_LEADS_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Spedire Leads"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "62c3880f-22ac-455a-9d93-2376c3aeb6a6",
      "name": "Merge Contact Detail Result",
      "type": "n8n-nodes-base.merge",
      "position": [
        1120,
        -256
      ],
      "parameters": {
        "numberInputs": 3
      },
      "typeVersion": 3.2
    },
    {
      "id": "80e9b070-4673-4770-a683-f5694e22a096",
      "name": "Check is New or Cached is available1",
      "type": "n8n-nodes-base.if",
      "position": [
        448,
        -384
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "2f1ef202-e090-478d-9cc3-2d57d3571bd1",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.is_new }}",
              "rightValue": {}
            },
            {
              "id": "594d36bb-7396-44c2-82a9-5ca57a21276c",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.url }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "54284217-67f0-48ed-81f8-b95dd43b068a",
      "name": "Sticky Note - Setup & Configuration",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4960,
        -656
      ],
      "parameters": {
        "color": 7,
        "width": 1396,
        "height": 4948,
        "content": "## Spedire Lead Enrichment \u2014 Setup & Configuration\n\n### Setup first before running this workflow\nThis workflow needs Google Sheets, MrScraper scrapers, MrScraper API access, and a SERP API connection before it can run correctly. After setup, the workflow will take marketplace product URLs, enrich them with product and seller data, discover the seller\u2019s likely company website, find the contact page, and extract emails/phone numbers into Google Sheets.\n\n---\n\n### 1) Google Sheets setup\n\nCreate or duplicate **two Google Sheets** before running the workflow.\n\n**A) Product URL Queue Sheet**\n\nThis sheet is the input queue for product pages you want to process.\n\nRequired columns:\n- `Url` \u2192 marketplace product detail URL to scrape\n- `status` \u2192 leave blank for new rows; the workflow updates this to `finished` after processing\n\nExample:\n- `Url`: product detail page URL\n- `status`: blank / `finished`\n\n**B) Leads Output Sheet**\n\nThis sheet stores the enriched lead results.\n\nRecommended columns:\n- `url`\n- `company_url`\n- `contact_url`\n- `productTitle`\n- `productSummary`\n- `productDescription`\n- `Specification`\n- `Shipping Detail`\n- `sellerName`\n- `sellerCountry`\n- `seller_page_url`\n- `business_name`\n- `business_address`\n- `business_license_number`\n- `emails`\n- `phones`\n\nConnect both sheets using your **Google Sheets OAuth2 credential** in n8n.\n\n---\n\n### 2) MrScraper credentials setup\n\nAdd your **MrScraper API credential** in n8n and connect it to all MrScraper nodes.\n\nYou also need a **MrScraper API token** for Code nodes that check previous scraper results/cache through the MrScraper Results API. This lets the workflow avoid scraping the same URL again when cached data already exists.\n\nReplace placeholder values such as:\n- `YOUR_MRSCRAPER_API_TOKEN`\n- MrScraper credential placeholders\n- Any scraper IDs if you create your own scrapers\n\n---\n\n### 3) Create MrScraper scraper: Product Detail & Seller Detail\n\nCreate a MrScraper scraper for product pages.\n\n**Input**\n- Product detail URL from the Google Sheets queue\n\n**Expected output**\nThe scraper should return two main objects:\n\n**A) Detail Product**\nRecommended fields:\n- product URL\n- title\n- description\n- favorites count\n- specifications such as brand, model, designer, manufacturer, country of origin, material, style, colour, condition, period/year, dimensions\n- shipping destination, shipping cost, pickup location\n\n**B) Seller Detail**\nRecommended fields:\n- seller ID\n- seller URL\n- canonical seller URL\n- country\n- business name\n- business address\n- business registration/license number\n\nThis workflow uses this scraper to enrich each product row and write product + seller details into the Leads Output Sheet.\n\n---\n\n### 4) SERP API setup \u2014 discover company URL\n\nSet up your SERP API endpoint/token in the HTTP Request node.\n\n**Input**\n- Seller name / business name\n- Seller address or seller country\n\nThe workflow searches Google using a query like:\n\n`sellerName + sellerAddress`\n\nor, if address is unavailable:\n\n`sellerName + sellerCountry`\n\n**Expected output**\n- A list of Google search results\n\nThe workflow then scores and filters those results to find the most likely official company website.\n\nIt avoids common non-company domains such as:\n- Facebook\n- Instagram\n- LinkedIn\n- Amazon\n- eBay\n- Etsy\n- Catawiki\n- Trustpilot\n- Wikipedia\n- Google\n- marketplace/review/social platforms\n\n**Final output**\n- `company_url`\n\nThis value is saved back into the Leads Output Sheet.\n\n---\n\n### 5) Create MrScraper scraper: Contact URL Finder\n\nCreate a MrScraper scraper that receives a company website and finds the most likely contact page.\n\n**Input**\n- `company_url`\n\n**Expected behavior**\nThe scraper should inspect common navigation areas such as:\n- header menu\n- footer menu\n- contact links\n- about/company pages\n- customer service links\n- legal/business information links\n\n**Expected output**\n- `contact_url`\n\nExamples of valid contact URLs (You can modify the pattern):\n- `/contact`\n- `/contacts`\n- `/contact-us`\n- `/contatti`\n- `/about`\n- `/customer-service`\n- footer/header contact link\n\nThis workflow saves the discovered `contact_url` into the Leads Output Sheet.\n\n---\n\n### 6) Create MrScraper scraper: Contact Detail Scraper\n\nCreate a MrScraper scraper that extracts contact information from the contact page.\n\n**Input**\n- `contact_url`\n\n**Expected output**\n- `emails`\n- `phones`\n\nOptional useful fields:\n- business name\n- address\n- VAT/tax number\n- social links\n- contact form URL\n\nThe workflow checks cached MrScraper results first. If the contact detail has already been scraped before, it reuses the cached result instead of running the scraper again.\n\n---\n\n### 7) Optional n8n execution guard\nThis workflow includes a duplicate-execution guard that checks running executions using the n8n API. Use this only if you want to prevent multiple runs of the same workflow at the same time.\n\nRequired value:\n- `YOUR_N8N_API_KEY`\n- `YOUR_WORKFLOW_ID`\n- your n8n instance API URL\n\nIf you do not need this feature, you can remove or disable the duplicate-execution check section.\n\n---\n\n### Values you must replace after import\n\nReplace these placeholders before running:\n- `YOUR_PRODUCT_URL_SHEET_ID`\n- `YOUR_LEADS_SHEET_ID`\n- `YOUR_WORKFLOW_ID`\n- `YOUR_N8N_API_KEY`\n- `YOUR_MRSCRAPER_API_TOKEN`\n- SERP API token / endpoint\n- Product Detail & Seller Detail scraper ID\n- Contact URL Finder scraper ID\n- Contact Detail scraper ID\n- Google Sheets credential\n- MrScraper credential\n\n---\n\n### Community publishing safety\n\nBefore publishing this workflow to the n8n Community, make sure you do not include:\n- private API keys\n- MrScraper tokens\n- SERP API tokens\n- cookies\n- Google Sheet IDs\n- credential IDs or credential names\n- private n8n instance URLs\n- real workflow IDs\n- private customer or lead data\n\nUse placeholders for all sensitive values so other users can safely import and configure the workflow with their own accounts."
      },
      "typeVersion": 1
    },
    {
      "id": "53ce9842-38e6-4939-9683-17cefdc15de9",
      "name": "Sticky Note Phase Header 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3232,
        1920
      ],
      "parameters": {
        "color": 4,
        "width": 652,
        "height": 292,
        "content": "## Phase 1 \u2014 Manual Start & Duplicate-Run Guard"
      },
      "typeVersion": 1
    },
    {
      "id": "2971d836-42d2-489a-861e-6bc28a9feae9",
      "name": "Sticky Note Phase 1 Notes",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3232,
        2224
      ],
      "parameters": {
        "color": 4,
        "width": 652,
        "height": 390,
        "content": "### Phase 1 \u2014 What happens here\n1. The workflow starts manually from **Execute workflow**.\n2. The **Check If there's execution** code node calls the n8n executions API and counts running executions for this workflow.\n3. **Run if only one execution exists** only lets the workflow continue when the running count equals `1`.\n\n### Why this matters\nThis prevents two active runs from updating the same Google Sheet rows or scraping the same URLs at the same time.\n\n### Setup note\nReplace the n8n API URL, workflow ID, and API key placeholders before enabling this guard in your own instance."
      },
      "typeVersion": 1
    },
    {
      "id": "9e3ac43a-ec3a-492f-a4ea-403610f0e9b6",
      "name": "Sticky Note Phase Header 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2544,
        1920
      ],
      "parameters": {
        "color": 2,
        "width": 1272,
        "height": 292,
        "content": "## Phase 2 \u2014 Product URL Queue & Product Detail Scraping"
      },
      "typeVersion": 1
    },
    {
      "id": "eed740f0-419c-473a-af18-d41346577350",
      "name": "Sticky Note Phase 2 Notes",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2544,
        2224
      ],
      "parameters": {
        "color": 2,
        "width": 1272,
        "height": 392,
        "content": "### Phase 2 \u2014 What happens here\n1. **Get Product url** reads product URLs from the Product URL Queue Google Sheet.\n2. **Loop Over Product Url** processes rows in batches of 100.\n3. **Check Cached Product Detail Result** checks MrScraper result history for each product URL.\n4. If cached product detail exists, the workflow reuses it. If not, **Run Detail Product Scraper** runs the product detail scraper.\n5. **Merge Product Detail Data** joins cached and newly scraped outputs into one path.\n\n### Cache behavior\nThe cache check looks for a valid `Detail_product.title`. It also handles MrScraper responses where the result is too large by fetching the result detail endpoint.\n\n### Output from this phase\nThe next phase receives normalized product and seller detail data, whether it came from cache or a fresh scrape."
      },
      "typeVersion": 1
    },
    {
      "id": "5341b3a8-e311-4a79-b350-c4241bcc29ea",
      "name": "Sticky Note Phase Header 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1248,
        1920
      ],
      "parameters": {
        "color": 5,
        "width": 724,
        "height": 284,
        "content": "## Phase 3 \u2014 Normalize Product + Seller Data into Leads Sheet"
      },
      "typeVersion": 1
    },
    {
      "id": "ac016255-574c-4f87-865f-8782e2f594f1",
      "name": "Sticky Note Phase 3 Notes",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1248,
        2224
      ],
      "parameters": {
        "color": 5,
        "width": 724,
        "height": 436,
        "content": "### Phase 3 \u2014 What happens here\n1. **Formatting Data** flattens nested MrScraper output into clean spreadsheet columns.\n2. It extracts product information, specs, shipping data, images, seller profile, business details, seller stats, and lot/category data.\n3. **Append or update Product Detail in Sheets** writes the normalized row into the Leads Google Sheet using `url` as the matching key.\n4. **Append or update url's scraped status** updates the source queue sheet and marks the product URL as `finished`.\n\n### Key fields created\n- Product: `productTitle`, `productSummary`, `productDescription`, images, favorites count\n- Specs: era, brand, model, material, condition, style, dimensions, year, period\n- Seller: seller name, seller URL, seller country, verified/type/stats\n- Business: `business_name`, `business_address`, `business_license_number`\n\n### Resume-safe design\nBecause product rows are append-or-updated and queue rows are marked `finished`, the workflow can continue from where it left off after interruption."
      },
      "typeVersion": 1
    },
    {
      "id": "e9edf489-a6f9-401a-a587-a8ac3f5fc7eb",
      "name": "Sticky Note Phase Header 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1968,
        1088
      ],
      "parameters": {
        "color": 6,
        "width": 1600,
        "height": 388,
        "content": "## Phase 4 \u2014 Discover the Seller Company Website"
      },
      "typeVersion": 1
    },
    {
      "id": "bb86463b-d1b3-4352-ad6e-351477f200ef",
      "name": "Sticky Note Phase 4 Notes",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1968,
        1488
      ],
      "parameters": {
        "color": 6,
        "width": 1600,
        "height": 376,
        "content": "### Phase 4 \u2014 What happens here\n1. **Get sellerDetail filter by Seller Country** reads rows from the Leads Sheet where `sellerCountry = Italy`.\n2. **Filter License Exists & Company URL Not Yet Available** keeps rows that have useful business/license data but have no `company_url` yet.\n3. **Loop SERP Company URL by Seller Detail** processes candidates in batches of 500 (the batch size 500 because of many of them sometimes getting filtered).\n4. **request SERP API** searches Google using seller/business name + country.\n5. **Filter Legit Company Profile Url** scores search results and selects the most likely official company website.\n6. **Append or update company Url** saves the selected `company_url` back into the Leads Sheet.\n7. **Merge Serp Result** keeps the loop moving after update/error paths.\n\n### Website scoring logic\nThe code removes noisy domains like social media, marketplaces, review sites, Google/Bing, Wikipedia, Amazon, eBay, Etsy, and Catawiki. It then scores candidates by domain token match, substring match, full-name match, title/snippet match, homepage bonus, search rank, and blog/builder penalties.\n\n### Confidence control\nOnly candidates with a score above the threshold are saved. Adjust `CONFIDENCE_THRESHOLD` inside the scoring code if you want stricter or looser matching."
      },
      "typeVersion": 1
    },
    {
      "id": "75f93066-9bdd-46ce-a75c-1eb17ddbdf4b",
      "name": "Sticky Note Phase Header 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1296,
        368
      ],
      "parameters": {
        "color": 3,
        "width": 1612,
        "height": 384,
        "content": "## Phase 5 \u2014 Find Contact Page from Company Website"
      },
      "typeVersion": 1
    },
    {
      "id": "9df533e8-b096-4867-b6eb-91c569a6f6e9",
      "name": "Sticky Note Phase 5 Notes",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1296,
        768
      ],
      "parameters": {
        "color": 3,
        "width": 1612,
        "height": 288,
        "content": "### Phase 5 \u2014 What happens here\n1. **Get row(s) Company Url filterBy sellerCountry** loads lead rows from the Leads Sheet.\n2. **Loop Scrape ContactUrl** batches rows with company URLs.\n3. **Filter Company Url Exists & Contact Url Not Yet Available** keeps rows where `company_url` exists but `contact_url` is still empty.\n4. **Run Contact Url Scraper** uses MrScraper to find likely contact/about/contact-us pages from the company website.\n5. **Flatten Data** chooses the best returned URL. It prioritizes URLs with deeper paths and longer strings because contact pages are often nested.\n6. **Append or update row in Contact Url** writes the selected `contact_url` into the Leads Sheet.\n7. **Merge** connects the contact-url discovery section into the next enrichment path.\n\n### Expected result\nEach valid company website gets one best `contact_url`, ready for the final email/phone extraction step."
      },
      "typeVersion": 1
    },
    {
      "id": "3222f6b0-fdb5-48c4-aa87-0ad9b6b0f930",
      "name": "Sticky Note Phase Header 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        -512
      ],
      "parameters": {
        "color": 5,
        "width": 1760,
        "height": 468,
        "content": "## Phase 6 \u2014 Scrape Email & Phone from Contact Pages"
      },
      "typeVersion": 1
    },
    {
      "id": "b0964c42-eb95-4b22-9aa1-f3ef4e93bead",
      "name": "Sticky Note Phase 6 Notes",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        -32
      ],
      "parameters": {
        "color": 5,
        "width": 1760,
        "height": 368,
        "content": "### Phase 6 \u2014 What happens here\n1. **Get ContactUrl** reads rows from the Leads Sheet.\n2. **Loop Scrape Detail Contact** batches contact-page rows.\n3. **Filter Contact Url Exists & Contact Not Yet Available** keeps rows where `contact_url` exists but `phones` is empty.\n4. **Check Cached Result Contact Detail1** checks MrScraper result history for the contact URL before scraping again.\n5. **Check is New or Cached is available1** decides whether to run a fresh scrape.\n6. **Run Contact Detail Scraper** extracts emails and phone numbers from the contact page when no cache is available.\n7. **Append or update Contact Detail** and **Append or update Contact Detail1** write cached or freshly scraped `emails` and `phones` into the Leads Sheet.\n8. **Merge Contact Detail Result** completes the batch loop.\n\n### Cache-first design\nThis phase avoids re-running the contact-detail scraper when cached email data already exists for the same contact URL.\n\n### Final output\nThe Leads Sheet ends with enriched rows containing product data, seller/business data, company website, contact page, email addresses, and phone numbers."
      },
      "typeVersion": 1
    },
    {
      "id": "28b3ea64-920c-4a7c-8c1a-8d15720ca792",
      "name": "Sticky Note - Troubleshooting & Customization",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3424,
        -640
      ],
      "parameters": {
        "color": 7,
        "width": 1336,
        "height": 620,
        "content": "## Troubleshooting & Customization\n\n### Common setup checks\n- Confirm both Google Sheets contain the exact column names used in the node mappings.\n- Confirm the MrScraper scraper IDs match the correct scraper type and Output structured:\n  - Product Detail Scraper\n  - Contact URL Scraper\n  - Contact Detail Scraper\n- Replace all placeholder API tokens and credentials after importing.\n- Test with 1\u20133 rows first before running large batches.\n\n### Tuning batch size\nCurrent batch sizes:\n- Product URLs: 100\n- SERP/company lookup: 500\n- Contact URL/detail flows: 500\n\nLower the batch size if you hit API rate limits, Google Sheets quota limits, or scraper timeouts.\n\n### Improving company URL accuracy\nEdit the blacklist and scoring weights inside **Filter Legit Company Profile Url**. Increase `CONFIDENCE_THRESHOLD` for stricter matching, or lower it if too many valid sellers are skipped.\n\n### Publishing to n8n Community\nThis workflow demonstrates cache-first scraping, sheet-based queueing, SERP scoring, and lead enrichment. Keep placeholders in the public version and ask users to add their own credentials and scraper IDs."
      },
      "typeVersion": 1
    },
    {
      "id": "feeada3e-43c8-4bdf-808f-0a33a29fe9cf",
      "name": "Check If there's execution",
      "type": "n8n-nodes-base.code",
      "position": [
        -2960,
        2032
      ],
      "parameters": {
        "jsCode": "const raw_data = $input.all();\nconst cutoffTime = new Date();\ncutoffTime.setHours(6, 30, 0, 0);\nconst today = new Date().toISOString().split('T')[0];\n\nconst response = await this.helpers.httpRequest({\n    method: 'GET',\n    url: `https://YOUR_N8N_INSTANCE_URL/api/v1/executions?status=running`,\n    headers: {\n        'accept': 'application/json',\n        \"X-N8N-API-KEY\": \"YOUR_N8N_API_KEY\"\n    },\n});\n\nlet runningCount = 0\nfor (const execution of response.data) {\n    if (execution.workflowId === \"YOUR_WORKFLOW_ID\") {\n        runningCount++;\n    }\n}\n\nreturn {\n    runningCount,\n}"
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "35137a9c-5997-4709-8190-5b9976f19ad7",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Loop Scrape ContactUrl",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Flatten Data": {
      "main": [
        [
          {
            "node": "Append or update row in Contact Url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get ContactUrl": {
      "main": [
        [
          {
            "node": "Loop Scrape Detail Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Formatting Data": {
      "main": [
        [
          {
            "node": "Append or update Product Detail in Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Product url": {
      "main": [
        [
          {
            "node": "Loop Over Product Url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "request SERP API": {
      "main": [
        [
          {
            "node": "Filter Legit Company Profile Url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Serp Result": {
      "main": [
        [
          {
            "node": "Loop SERP Company URL by Seller Detail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Product Url": {
      "main": [
        [
          {
            "node": "Get sellerDetail filter by Seller Country",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check Cached Product Detail Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Scrape ContactUrl": {
      "main": [
        [
          {
            "node": "Get ContactUrl",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Filter Company Url Exists & Contact Url Not Yet Available",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Contact Url Scraper": {
      "main": [
        [
          {
            "node": "Flatten Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Product Detail Data": {
      "main": [
        [
          {
            "node": "Formatting Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If there's execution": {
      "main": [
        [
          {
            "node": "Run if only one execution exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Scrape Detail Contact": {
      "main": [
        [],
        [
          {
            "node": "Filter Contact Url Exists & Contact Not Yet Available",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Contact Detail Scraper": {
      "main": [
        [
          {
            "node": "Append or update Contact Detail1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Detail Product Scraper": {
      "main": [
        [
          {
            "node": "Merge Product Detail Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Contact Detail Result": {
      "main": [
        [
          {
            "node": "Loop Scrape Detail Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append or update company Url": {
      "main": [
        [
          {
            "node": "Merge Serp Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append or update Contact Detail": {
      "main": [
        [
          {
            "node": "Merge Contact Detail Result",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Append or update Contact Detail1": {
      "main": [
        [
          {
            "node": "Merge Contact Detail Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Legit Company Profile Url": {
      "main": [
        [
          {
            "node": "Append or update company Url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run if only one execution exists": {
      "main": [
        [
          {
            "node": "Get Product url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Cached Product Detail Result": {
      "main": [
        [
          {
            "node": "Check is New or Cached is available",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append or update row in Contact Url": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Cached Result Contact Detail1": {
      "main": [
        [
          {
            "node": "Check is New or Cached is available1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check is New or Cached is available": {
      "main": [
        [
          {
            "node": "Run Detail Product Scraper",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge Product Detail Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Check is New or Cached is available1": {
      "main": [
        [
          {
            "node": "Run Contact Detail Scraper",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Append or update Contact Detail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Check If there's execution",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append or update url's scraped status": {
      "main": [
        [
          {
            "node": "Loop Over Product Url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop SERP Company URL by Seller Detail": {
      "main": [
        [
          {
            "node": "Get row(s) Company Url filterBy sellerCountry",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Filter License Exists & Company URL Not Yet Available",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append or update Product Detail in Sheets": {
      "main": [
        [
          {
            "node": "Append or update url's scraped status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get sellerDetail filter by Seller Country": {
      "main": [
        [
          {
            "node": "Loop SERP Company URL by Seller Detail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) Company Url filterBy sellerCountry": {
      "main": [
        [
          {
            "node": "Loop Scrape ContactUrl",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Contact Url Exists & Contact Not Yet Available": {
      "main": [
        [
          {
            "node": "Check Cached Result Contact Detail1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge Contact Detail Result",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Filter License Exists & Company URL Not Yet Available": {
      "main": [
        [
          {
            "node": "request SERP API",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge Serp Result",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Filter Company Url Exists & Contact Url Not Yet Available": {
      "main": [
        [
          {
            "node": "Run Contact Url Scraper",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  }
}