{
  "name": "Detect offboarded client links on PBN sites with Google Sheets and HTTP",
  "nodes": [
    {
      "id": "5d647c78-50ae-4c73-84d8-2a75c895154b",
      "name": "Run Workflow Manually",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        0
      ]
    },
    {
      "id": "c24a19f6-a041-4d24-b169-907f45e762ef",
      "name": "Read PBN Sites from Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        208,
        0
      ]
    },
    {
      "id": "2c18d612-aa4f-4cae-81f6-5b3744eba319",
      "name": "Filter Unprocessed PBN Rows",
      "type": "n8n-nodes-base.code",
      "position": [
        416,
        0
      ]
    },
    {
      "id": "a66eb36b-46ef-4cc0-89be-2e53c32d5d24",
      "name": "Loop Through Each PBN",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        624,
        0
      ]
    },
    {
      "id": "f48e6d1c-5ff6-45c3-9ca0-780b01ce4640",
      "name": "Fetch PBN Site HTML",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        864,
        16
      ]
    },
    {
      "id": "404d6187-7fd6-4811-8844-fc4e3712b6fe",
      "name": "Read Offboarded Project Domains",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1072,
        16
      ]
    },
    {
      "id": "05c73580-d4c0-4da1-973b-e5e5e2a10f7b",
      "name": "Match Domains in HTML",
      "type": "n8n-nodes-base.code",
      "position": [
        1280,
        16
      ]
    },
    {
      "id": "30df9e6e-4ca4-4f50-8021-6d76ee8ebdab",
      "name": "Prepare Row Update Payload",
      "type": "n8n-nodes-base.set",
      "position": [
        1488,
        16
      ]
    },
    {
      "id": "db8377d6-1fe3-4ec6-916f-1794aef3b426",
      "name": "Write Matched Domain to PBNs Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1680,
        16
      ]
    },
    {
      "id": "17a1feff-ba0f-4323-b817-83b7f34b9ed5",
      "name": "Pause Before Next Iteration",
      "type": "n8n-nodes-base.wait",
      "position": [
        1856,
        16
      ]
    },
    {
      "id": "bdbdc364-db6a-4cfe-aee2-2c8dc244bbbf",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -240
      ],
      "parameters": {
        "width": 432,
        "height": 656,
        "content": "## PBN Offboarded Link Checker\n\nThis workflow automatically checks all PBN sites to detect\nif any offboarded client domain is still linked on them.\nIt runs row by row, fetches live HTML of each PBN, a"
      }
    },
    {
      "id": "742384c7-ca32-484b-845c-30c6ccfddd79",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        -144
      ],
      "parameters": {
        "width": 304,
        "height": 192,
        "content": "## Data Fetching\n\nReads all PBN rows from Google Sheets,\nthen filters out already-processed rows\nso only new/unchecked PBNs move forward."
      }
    },
    {
      "id": "10e0cfbe-8107-4e4d-9ec4-9c4d65783514",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        -144
      ],
      "parameters": {
        "width": 752,
        "height": 208,
        "content": "## HTML Fetch & Domain Matching\n\nLoops through each PBN one by one, fetches\nits live HTML, then checks if any offboarded\nclient domain is present inside that HTML."
      }
    },
    {
      "id": "eac0c950-5152-44e3-b124-2845a12826d0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1488,
        -144
      ],
      "parameters": {
        "width": 464,
        "height": 208,
        "content": "## Update & Loop Back\n\nStructures the matched result, writes it\ninto the PBNs sheet, then pauses briefly\nbefore moving to the next PBN in the loop."
      }
    }
  ],
  "connections": {
    "Fetch PBN Site HTML": {
      "main": [
        [
          {
            "node": "Read Offboarded Project Domains",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Through Each PBN": {
      "main": [
        [],
        [
          {
            "node": "Fetch PBN Site HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Match Domains in HTML": {
      "main": [
        [
          {
            "node": "Prepare Row Update Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Workflow Manually": {
      "main": [
        [
          {
            "node": "Read PBN Sites from Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read PBN Sites from Sheet": {
      "main": [
        [
          {
            "node": "Filter Unprocessed PBN Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Row Update Payload": {
      "main": [
        [
          {
            "node": "Write Matched Domain to PBNs Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Unprocessed PBN Rows": {
      "main": [
        [
          {
            "node": "Loop Through Each PBN",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pause Before Next Iteration": {
      "main": [
        [
          {
            "node": "Loop Through Each PBN",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Offboarded Project Domains": {
      "main": [
        [
          {
            "node": "Match Domains in HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Matched Domain to PBNs Sheet": {
      "main": [
        [
          {
            "node": "Pause Before Next Iteration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}