{
  "name": "Website Vector Store Template",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        1344,
        336
      ],
      "id": "ca48613f-cfa4-4206-b2fd-ddef45e5dfa9",
      "name": "Embeddings OpenAI",
      "credentials": {
        "openAiApi": {
          "id": "jLwStW8V16GXToXI",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "source",
                "value": "website"
              }
            ]
          }
        }
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        1168,
        336
      ],
      "id": "ca57fc0a-78e6-4f59-af35-7a4a4d214b72",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "url": "https://example.com/sitemap.xml",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -32,
        160
      ],
      "id": "51022bf8-fae3-439f-914c-5367574f17bd",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "jsCode": "const xml = items[0].json.data;\n\n// Match all <loc>...</loc> tags and extract the URLs\nconst matches = xml.match(/<loc>(.*?)<\\/loc>/g) || [];\n\nconst urls = matches.map(locTag => {\n  const url = locTag.replace(/<\\/?loc>/g, '');\n  return { json: { url } };\n});\n\nreturn urls;\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        240,
        160
      ],
      "id": "51a1d967-4ffa-456e-8495-8f0a98f1c373",
      "name": "Code"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        544,
        160
      ],
      "id": "e31bd2c0-5279-4710-ba6f-939799238ad5",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "text"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        768,
        272
      ],
      "id": "f948578b-3f89-4542-bbf4-1cd96e753932",
      "name": "HTTP Request1"
    },
    {
      "parameters": {
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "cssSelector": "body"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.html",
      "typeVersion": 1.2,
      "position": [
        960,
        272
      ],
      "id": "787ee0ba-fa6f-485c-9e20-b7184df27a24",
      "name": "HTML"
    },
    {
      "parameters": {
        "mode": "insert",
        "tableName": "vector_store",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
      "typeVersion": 1.3,
      "position": [
        1232,
        144
      ],
      "id": "c4399802-4ea1-4952-afee-5ca1691b2dde",
      "name": "Postgres PGVector Store",
      "credentials": {
        "postgres": {
          "id": "JWoMnzDf7Z9gsVPg",
          "name": "Postgres account"
        }
      }
    },
    {
      "parameters": {
        "operation": "deleteTable",
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "vector_store",
          "mode": "name"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        -304,
        160
      ],
      "id": "06d24b4d-23f9-4da6-824e-be123bbd782c",
      "name": "Clear vector store",
      "credentials": {
        "postgres": {
          "id": "JWoMnzDf7Z9gsVPg",
          "name": "Postgres account"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -544,
        160
      ],
      "id": "d1135978-edbc-4423-826f-172edf2bda13",
      "name": "When clicking ‘Execute workflow’"
    },
    {
      "parameters": {
        "content": "## IMPORTANT NOTE\nTurn off this node when running for the first time, else you will get an error as the table does not exist yet",
        "height": 336,
        "width": 256
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -384,
        0
      ],
      "id": "01b49f43-c373-4d5d-bbf2-85520147e004",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## NOTE\nReplace the url in this node with your sitemap url",
        "height": 336,
        "width": 224
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -96,
        0
      ],
      "id": "c1f2f812-1819-4627-b02c-2d1f9d4f6394",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "## Update Credentials\n",
        "height": 80,
        "width": 256,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -384,
        -96
      ],
      "id": "64eaade4-1518-4d71-a0bc-0e4175cd0743",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "## Update Credentials\n",
        "height": 80,
        "width": 224,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1232,
        48
      ],
      "id": "a931b09c-2719-403d-89c5-067ebd1e07a5",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "content": "## Update Credentials\n",
        "height": 80,
        "width": 176,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1296,
        448
      ],
      "id": "93607470-059e-418f-b599-15237891413d",
      "name": "Sticky Note4"
    }
  ],
  "pinData": {},
  "connections": {
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTML": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clear vector store": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Clear vector store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b67fcba7-d6a3-4aea-9119-a4f915485349",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "e592fdf17e0f5e1e2d257cb5482246d085959171f9a8a3e9366dee0ceb93a8c3"
  },
  "id": "9G4f22sx1hRFognY",
  "tags": [
    {
      "updatedAt": "2025-09-25T13:48:23.826Z",
      "createdAt": "2025-09-25T13:48:23.826Z",
      "id": "izuw1hSIhVc1N4I0",
      "name": "RAG Chatbot"
    }
  ]
}