{
  "name": "Scrape and ingest web content into Supabase pgvector with Firecrawl",
  "nodes": [
    {
      "id": "1221fcc2-23e9-40c8-8d25-5e8de01bf3fb",
      "name": "Receive company URL",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1136,
        336
      ]
    },
    {
      "id": "12509942-87e2-422d-b97a-3502bb7b4f2a",
      "name": "Validate and normalize URL",
      "type": "n8n-nodes-base.code",
      "position": [
        -912,
        336
      ]
    },
    {
      "id": "82d40c90-d166-4f8b-8224-489322aa007c",
      "name": "Check for duplicate in Supabase",
      "type": "n8n-nodes-base.supabase",
      "position": [
        -688,
        240
      ]
    },
    {
      "id": "85705c58-aaf9-487d-b358-f0d87f49afef",
      "name": "Return duplicate notice",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -240,
        144
      ]
    },
    {
      "id": "28f6fcb9-581a-4249-9a95-d5d6d3716873",
      "name": "Scrape company website with Firecrawl",
      "type": "@mendable/n8n-nodes-firecrawl.firecrawl",
      "position": [
        -240,
        336
      ]
    },
    {
      "id": "34256e66-c794-40ba-a579-b975dd2d2e82",
      "name": "Return URL validation error",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -688,
        432
      ]
    },
    {
      "id": "2b060cc6-1291-4913-ba4b-02d74917a945",
      "name": "Load scraped content",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        112,
        560
      ]
    },
    {
      "id": "95bc5d9a-a4bb-4f61-a051-511f811f7757",
      "name": "Generate OpenAI embeddings",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        -64,
        560
      ]
    },
    {
      "id": "0f82ceff-00a2-4486-89bd-18c0aa789d75",
      "name": "Receive chat message",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1136,
        704
      ]
    },
    {
      "id": "63d0275d-573b-4308-87a4-15510e8455a2",
      "name": "Answer query from enriched leads",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -912,
        704
      ]
    },
    {
      "id": "434db832-19d9-4a2a-8937-eb505c1e9371",
      "name": "OpenRouter LLM",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -1008,
        896
      ]
    },
    {
      "id": "f2f212d5-d6df-4a25-828b-d1447ff05712",
      "name": "Chat memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -848,
        896
      ]
    },
    {
      "id": "666976cb-4d2f-4e29-8fe2-be220c02c26e",
      "name": "Generate OpenAI embeddings1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        -688,
        1056
      ]
    },
    {
      "id": "ef08cbc2-9cb9-4ca4-8698-1748140d8fc7",
      "name": "Rerank results with Cohere",
      "type": "@n8n/n8n-nodes-langchain.rerankerCohere",
      "position": [
        -528,
        1056
      ]
    },
    {
      "id": "a92fe745-93f2-471b-a140-e9e0367bb5cd",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1776,
        336
      ],
      "parameters": {
        "width": 512,
        "height": 448,
        "content": "### How it works\n1. A webhook receives a URL via POST request\n2. The URL is validated, normalized, and checked for duplicates in Supabase\n3. Firecrawl scrapes the page and converts it to clean markdow"
      }
    },
    {
      "id": "43f6a78c-69d8-4aa0-8fc7-9bcd44e8f2a4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1776,
        800
      ],
      "parameters": {
        "width": 512,
        "height": 96,
        "content": "## Supabase setup\nRun the SQL migration from the workflow README to create the `documents` table with pgvector enabled."
      }
    },
    {
      "id": "be2a6f00-ee44-4eb8-bb19-e361f5b3577f",
      "name": "Skip if already ingested",
      "type": "n8n-nodes-base.if",
      "position": [
        -464,
        240
      ]
    },
    {
      "id": "b8c12e9c-9a86-408e-a015-bf6587605a32",
      "name": "Store embeddings in Supabase",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        -16,
        336
      ]
    },
    {
      "id": "e46086f3-028a-44b2-8035-af14f2067b64",
      "name": "Return ingestion result",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        336,
        336
      ]
    },
    {
      "id": "d36fe25d-386d-4262-9faa-8d89f6a3abfd",
      "name": "Retrieve documents from Supabase",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        -624,
        864
      ]
    }
  ],
  "connections": {
    "Chat memory": {
      "ai_memory": [
        [
          {
            "node": "Answer query from enriched leads",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter LLM": {
      "ai_languageModel": [
        [
          {
            "node": "Answer query from enriched leads",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Receive company URL": {
      "main": [
        [
          {
            "node": "Validate and normalize URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load scraped content": {
      "ai_document": [
        [
          {
            "node": "Store embeddings in Supabase",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Receive chat message": {
      "main": [
        [
          {
            "node": "Answer query from enriched leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Skip if already ingested": {
      "main": [
        [
          {
            "node": "Return duplicate notice",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Scrape company website with Firecrawl",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate OpenAI embeddings": {
      "ai_embedding": [
        [
          {
            "node": "Store embeddings in Supabase",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Rerank results with Cohere": {
      "ai_reranker": [
        [
          {
            "node": "Retrieve documents from Supabase",
            "type": "ai_reranker",
            "index": 0
          }
        ]
      ]
    },
    "Validate and normalize URL": {
      "main": [
        [
          {
            "node": "Check for duplicate in Supabase",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Return URL validation error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate OpenAI embeddings1": {
      "ai_embedding": [
        [
          {
            "node": "Retrieve documents from Supabase",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Store embeddings in Supabase": {
      "main": [
        [
          {
            "node": "Return ingestion result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for duplicate in Supabase": {
      "main": [
        [
          {
            "node": "Skip if already ingested",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve documents from Supabase": {
      "ai_tool": [
        [
          {
            "node": "Answer query from enriched leads",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Scrape company website with Firecrawl": {
      "main": [
        [
          {
            "node": "Store embeddings in Supabase",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}