{
  "name": "AI-powered lead enrichment with Bright Data MCP and Google Sheets",
  "nodes": [
    {
      "id": "80ffc9b5-2a35-46e3-a641-45ae6f9556bd",
      "name": "Google Sheets Trigger",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -5820,
        2140
      ]
    },
    {
      "id": "06d817c6-f625-495e-bfd3-d019a98f0ebb",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -3260,
        2280
      ]
    },
    {
      "id": "18ef61dc-5134-4c8b-817b-da162c093b06",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -5880,
        1920
      ],
      "parameters": {
        "width": 460,
        "height": 540,
        "content": "## Watch for the updated record in Google Sheets based on the column 'status'\nWrite 'needs more enrichment' in the status column if you want to retry the enrichment\n"
      }
    },
    {
      "id": "e3b79eff-1504-4da3-85ef-4423f5ee71cd",
      "name": "Auto-fixing Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        -3480,
        2080
      ]
    },
    {
      "id": "1023e561-8f92-4fe1-8d21-1b6fcd2bbb6e",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -3500,
        2200
      ]
    },
    {
      "id": "ac4f57e8-f7f0-47b8-b039-9a93f198083a",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -6620,
        1440
      ],
      "parameters": {
        "width": 520,
        "height": 540,
        "content": "## Manually run the records that is needed enrichment\n"
      }
    },
    {
      "id": "c46b338f-ccb6-4ce4-a1a3-623a615d19b2",
      "name": "Process each leads one by one",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -4620,
        1260
      ]
    },
    {
      "id": "e6f86e5f-f49f-4781-90d2-78747efd5053",
      "name": "Filter the leads that needs enrichment",
      "type": "n8n-nodes-base.filter",
      "position": [
        -5600,
        2140
      ]
    },
    {
      "id": "46203489-bdd1-48ea-a020-8f5e1734cbdb",
      "name": "Remove unneccessary fields for the prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        -4100,
        1260
      ]
    },
    {
      "id": "838ba8a6-3f41-4973-b5aa-805b9abc6baa",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        720
      ],
      "parameters": {
        "width": 980,
        "height": 1620,
        "content": "# Update the record in Google Sheet"
      }
    },
    {
      "id": "1315c393-9cb2-4345-ba01-34faa5673e72",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4260,
        1040
      ],
      "parameters": {
        "width": 840,
        "height": 740,
        "content": "# AI Agent with Bright Data MCP attached\nPlease play around which model suited best"
      }
    },
    {
      "id": "f77f311d-20c4-4e5d-a679-f905a5e1680a",
      "name": "Bright Data MCP Client",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        -3760,
        1540
      ]
    },
    {
      "id": "f5d6bf43-d9c0-4272-9d5f-cf1371f0e27a",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -4000,
        1540
      ]
    },
    {
      "id": "370ea5eb-0abc-418a-836f-f9e28d3f11be",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3360,
        1040
      ],
      "parameters": {
        "width": 1160,
        "height": 760,
        "content": "# Formating the results and comparing it to the original"
      }
    },
    {
      "id": "cc8043c0-6306-4808-9caf-0776b9a29553",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        -2980,
        1440
      ]
    },
    {
      "id": "7cfe0f1d-d2ef-4630-b4d4-5ef155852f4c",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -3240,
        1280
      ]
    },
    {
      "id": "f4357d32-0d4f-4131-8367-63ac527bb9e2",
      "name": "If2",
      "type": "n8n-nodes-base.if",
      "position": [
        -2980,
        1120
      ]
    },
    {
      "id": "0efb7c41-869f-4803-b725-7133fe74dfd6",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        -2620,
        1620
      ]
    },
    {
      "id": "5478a933-3704-4282-a043-b61e7c84c86e",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        -2980,
        1280
      ]
    },
    {
      "id": "b96100ab-1edf-46ce-8c1d-c16c7617b327",
      "name": "Not matched route",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -2400,
        1200
      ]
    },
    {
      "id": "896fdbd8-e6b2-4e5e-8cbb-8c347714f541",
      "name": "Space requests by 5 seconds",
      "type": "n8n-nodes-base.wait",
      "position": [
        940,
        1440
      ]
    },
    {
      "id": "5e4b65b7-30b6-4980-a851-43b8112d6347",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3740,
        1960
      ],
      "parameters": {
        "width": 840,
        "height": 560,
        "content": "## Format the output"
      }
    },
    {
      "id": "146b61b9-cd18-4e72-b07f-4f848d909a66",
      "name": "Scraper AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -3880,
        1280
      ]
    },
    {
      "id": "bfbf1be5-96a7-470e-a3d2-006dbf948c4d",
      "name": "Merge1",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1560,
        1460
      ]
    },
    {
      "id": "fa2096a7-56d7-45aa-b10f-4ae7456339b4",
      "name": "Judge the accuracy of scraped data",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -2020,
        1280
      ]
    },
    {
      "id": "32f37490-752b-4ee1-b68f-c56f17615bf4",
      "name": "Just to make the connection neat",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1480,
        2480
      ]
    },
    {
      "id": "01f944b6-e821-4ca3-ba09-bbc33f562ef4",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2080,
        1020
      ],
      "parameters": {
        "width": 1160,
        "height": 740,
        "content": "# Identify the accuracy of the scraped data\nThis may serve as another layer of accuracy filtering"
      }
    },
    {
      "id": "08a34aec-7419-4cb9-b495-dff406c6f61d",
      "name": "Extract the AI results only",
      "type": "n8n-nodes-base.set",
      "position": [
        -1820,
        1280
      ]
    },
    {
      "id": "716a21d4-230d-4747-a031-ca8aac1bc3af",
      "name": "Check the confidence score",
      "type": "n8n-nodes-base.if",
      "position": [
        -720,
        1580
      ]
    },
    {
      "id": "a4eb12f7-26b9-4f8f-a51a-ff54c769c06b",
      "name": "Prepare the scraped output for Google Sheets",
      "type": "n8n-nodes-base.set",
      "position": [
        -1340,
        1560
      ]
    },
    {
      "id": "06bf86dc-c92f-4540-8963-219015d745fb",
      "name": "Add confidence score to Google Sheet",
      "type": "n8n-nodes-base.set",
      "position": [
        -1140,
        1580
      ]
    },
    {
      "id": "f6ba009f-47f1-428e-95e6-b3d8ca23208d",
      "name": "Add record if the confidence score is below 85%",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -100,
        2020
      ]
    },
    {
      "id": "9a5a4808-a8d1-4b49-82b5-b33bc48b56f5",
      "name": "Override the record if the confidence score is equal or greater than 85%",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -220,
        1400
      ]
    },
    {
      "id": "1eb07d73-aa8f-4cba-a760-5d142eea9734",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        1260
      ],
      "parameters": {
        "width": 480,
        "height": 360,
        "content": "## Override the record if the confidence score is equal or greater than 85%"
      }
    },
    {
      "id": "274d8c92-9094-4b26-8d6e-689e38fe9540",
      "name": "Update the status of the record",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -220,
        1020
      ]
    },
    {
      "id": "9958acae-7675-48c2-a400-0ee00267745f",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        1700
      ],
      "parameters": {
        "width": 480,
        "height": 560,
        "content": "## Append row if the confidence score is below 85%"
      }
    },
    {
      "id": "ae5d281a-31a3-46a0-b5af-8dcf376d2947",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        840
      ],
      "parameters": {
        "width": 480,
        "height": 360,
        "content": "## Scraped data doesn't match the source. This will only update the status of the record."
      }
    },
    {
      "id": "a5aa4f8f-d7ec-4d28-87a2-c774ba627a95",
      "name": "Update row_id and status",
      "type": "n8n-nodes-base.set",
      "position": [
        -300,
        2020
      ]
    },
    {
      "id": "2eb2c10a-1ab8-408f-9411-13fa356b4664",
      "name": "Update the status of the original record",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -240,
        1780
      ]
    },
    {
      "id": "e2cb5ff7-3d0d-4766-bda2-2ea5d1b8cf54",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -5960,
        780
      ]
    },
    {
      "id": "da05a953-9e66-49b5-8c62-5cd48f439772",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -5420,
        900
      ]
    },
    {
      "id": "48243a45-396f-4610-b97f-808ca39e90a6",
      "name": "HubSpot",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        -5680,
        900
      ]
    },
    {
      "id": "1088136d-5530-47f2-b08f-3c91c28bd383",
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -6280,
        1620
      ]
    },
    {
      "id": "16a4e5d7-3d4f-4aa4-b802-5bc61c6767b6",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -6520,
        1620
      ]
    },
    {
      "id": "2cf15cf0-be32-41d8-82f6-78a142e32b4a",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -6500,
        540
      ],
      "parameters": {
        "width": 1380,
        "height": 720,
        "content": "# New Contact trigger in Hubspot and Save it to Google Drive"
      }
    },
    {
      "id": "6a2d33a9-c2f9-412e-a70c-8a64b7da252b",
      "name": "New Contact in Hubpost (OAuth2)",
      "type": "n8n-nodes-base.hubspotTrigger",
      "position": [
        -6340,
        1020
      ]
    },
    {
      "id": "fd273f08-9d98-4539-bad1-96a1ea6c0fc5",
      "name": "New Contact in Hubpost (Private App)",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -6320,
        680
      ]
    },
    {
      "id": "d348c77a-7782-45c5-9d6d-d7464ff876c6",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        300,
        1560
      ]
    },
    {
      "id": "6a1149d6-186f-49ce-a8b3-3a97b83b10a7",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        440,
        1840
      ],
      "parameters": {
        "width": 680,
        "height": 500,
        "content": "# Update the Hubspot contact for the high confidence score"
      }
    },
    {
      "id": "2c3f4e27-a1ee-4a0a-8fb8-180b5de97ae6",
      "name": "Update the Hubspot Contact",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        880,
        2080
      ]
    },
    {
      "id": "fdadcb0e-f66e-4755-8939-ab28d51301eb",
      "name": "Set Desired Confidence Score",
      "type": "n8n-nodes-base.if",
      "position": [
        580,
        2100
      ]
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Not matched route",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Not matched route",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If2": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Not matched route",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          },
          {
            "node": "Judge the accuracy of scraped data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge1": {
      "main": [
        [
          {
            "node": "Prepare the scraped output for Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HubSpot": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "HubSpot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "Process each leads one by one",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets1": {
      "main": [
        [
          {
            "node": "Process each leads one by one",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scraper AI Agent": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Not matched route": {
      "main": [
        [
          {
            "node": "Update the status of the record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Scraper AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets Trigger": {
      "main": [
        [
          {
            "node": "Filter the leads that needs enrichment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bright Data MCP Client": {
      "ai_tool": [
        [
          {
            "node": "Scraper AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "No Operation, do nothing": {
      "main": [
        [
          {
            "node": "Set Desired Confidence Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Update row_id and status": {
      "main": [
        [
          {
            "node": "Add record if the confidence score is below 85%",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Auto-fixing Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Scraper AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Check the confidence score": {
      "main": [
        [
          {
            "node": "Override the record if the confidence score is equal or greater than 85%",
            "type": "main",
            "index": 0
          },
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update row_id and status",
            "type": "main",
            "index": 0
          },
          {
            "node": "Update the status of the original record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract the AI results only": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Space requests by 5 seconds": {
      "main": [
        [
          {
            "node": "Just to make the connection neat",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Desired Confidence Score": {
      "main": [
        [
          {
            "node": "Update the Hubspot Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process each leads one by one": {
      "main": [
        [],
        [
          {
            "node": "Remove unneccessary fields for the prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New Contact in Hubpost (OAuth2)": {
      "main": [
        [
          {
            "node": "HubSpot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update the status of the record": {
      "main": [
        [
          {
            "node": "Space requests by 5 seconds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Just to make the connection neat": {
      "main": [
        [
          {
            "node": "Process each leads one by one",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Judge the accuracy of scraped data": {
      "main": [
        [
          {
            "node": "Extract the AI results only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add confidence score to Google Sheet": {
      "main": [
        [
          {
            "node": "Check the confidence score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New Contact in Hubpost (Private App)": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter the leads that needs enrichment": {
      "main": [
        [
          {
            "node": "Process each leads one by one",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove unneccessary fields for the prompt": {
      "main": [
        [
          {
            "node": "Scraper AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare the scraped output for Google Sheets": {
      "main": [
        [
          {
            "node": "Add confidence score to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add record if the confidence score is below 85%": {
      "main": [
        [
          {
            "node": "Space requests by 5 seconds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Override the record if the confidence score is equal or greater than 85%": {
      "main": [
        [
          {
            "node": "Space requests by 5 seconds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}