{
  "name": "Website Scraper to Vector Store",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "scrape-and-store",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "wsvs0001-0001-4000-8000-000000000001",
      "name": "Scrape Request Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [240, 300]
    },
    {
      "parameters": {
        "url": "={{ $json.body.url }}",
        "options": {
          "timeout": 30000
        }
      },
      "id": "wsvs0001-0002-4000-8000-000000000002",
      "name": "Fetch Web Page",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [460, 300]
    },
    {
      "parameters": {
        "jsCode": "const html = $input.item.json.data || '';\n// Strip HTML tags and extract text\nconst text = html\n  .replace(/<script[\\s\\S]*?<\\/script>/gi, '')\n  .replace(/<style[\\s\\S]*?<\\/style>/gi, '')\n  .replace(/<[^>]+>/g, ' ')\n  .replace(/\\s+/g, ' ')\n  .trim();\nconst url = $('Scrape Request Webhook').item.json.body.url;\nreturn [{ json: { text, url, scrapedAt: new Date().toISOString() } }];"
      },
      "id": "wsvs0001-0003-4000-8000-000000000003",
      "name": "Extract Text from HTML",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [680, 300]
    },
    {
      "parameters": {
        "chunkSize": 600,
        "chunkOverlap": 100,
        "options": {}
      },
      "id": "wsvs0001-0004-4000-8000-000000000004",
      "name": "Chunk Page Content",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "typeVersion": 1,
      "position": [900, 300]
    },
    {
      "parameters": {
        "model": "text-embedding-3-small",
        "options": {}
      },
      "id": "wsvs0001-0005-4000-8000-000000000005",
      "name": "Embed Page Chunks",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1,
      "position": [1120, 300]
    },
    {
      "parameters": {
        "mode": "insert",
        "memoryKey": "website-content-store",
        "options": {}
      },
      "id": "wsvs0001-0006-4000-8000-000000000006",
      "name": "Store Embeddings",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1,
      "position": [1340, 300]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "name": "status",
              "value": "indexed",
              "type": "string"
            },
            {
              "name": "url",
              "value": "={{ $('Scrape Request Webhook').item.json.body.url }}",
              "type": "string"
            },
            {
              "name": "indexedAt",
              "value": "={{ new Date().toISOString() }}",
              "type": "string"
            }
          ]
        }
      },
      "id": "wsvs0001-0007-4000-8000-000000000007",
      "name": "Return Index Status",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [1560, 300]
    }
  ],
  "connections": {
    "Scrape Request Webhook": {
      "main": [[{ "node": "Fetch Web Page", "type": "main", "index": 0 }]]
    },
    "Fetch Web Page": {
      "main": [[{ "node": "Extract Text from HTML", "type": "main", "index": 0 }]]
    },
    "Extract Text from HTML": {
      "main": [[{ "node": "Chunk Page Content", "type": "main", "index": 0 }]]
    },
    "Chunk Page Content": {
      "main": [[{ "node": "Embed Page Chunks", "type": "main", "index": 0 }]]
    },
    "Embed Page Chunks": {
      "main": [[{ "node": "Store Embeddings", "type": "main", "index": 0 }]]
    },
    "Store Embeddings": {
      "main": [[{ "node": "Return Index Status", "type": "main", "index": 0 }]]
    }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "meta": {},
  "pinData": {}
}
