{
  "name": "WhatsApp RAG chatbot with Supabase, Gemini 2.5 Flash, and OpenAI embeddings",
  "nodes": [
    {
      "id": "d02befa0-18c6-4aa6-8c94-e84f6993a406",
      "name": "Retrieve Context from Supabase",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        480,
        496
      ]
    },
    {
      "id": "0a1543fa-c9ce-4d7a-8466-c778bb532cf9",
      "name": "New WhatsApp Message",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        -304,
        560
      ]
    },
    {
      "id": "79a849a1-da91-4af8-9ba4-7e6e504e4eeb",
      "name": "Check if Query or Document",
      "type": "n8n-nodes-base.switch",
      "position": [
        -48,
        560
      ]
    },
    {
      "id": "50a072f5-e8ce-4eae-adf9-8fbf4fd494da",
      "name": "Convert File to Text",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1008,
        1216
      ]
    },
    {
      "id": "3932f7f3-524e-40b1-87dd-c9ff1e85d95e",
      "name": "Generate OpenAI Embeddings",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        816,
        1216
      ]
    },
    {
      "id": "75f6cdb9-ef4f-43cd-83ae-b8ceb602b876",
      "name": "Store Embeddings in Supabase",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "position": [
        896,
        928
      ]
    },
    {
      "id": "d569775f-c2d0-4c12-bb89-fe36667de6ce",
      "name": "Google Gemini LLM",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        352,
        496
      ]
    },
    {
      "id": "ee2b82a8-cd95-4ff0-8e42-3d67eedd848d",
      "name": "RAG Query Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        368,
        272
      ]
    },
    {
      "id": "8eeb7e2c-11de-4ea5-8287-3ef026427f3d",
      "name": "Send WhatsApp Reply",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        912,
        272
      ]
    },
    {
      "id": "a73408a1-1ea2-4867-9c3d-8b6d54989d7d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        736
      ],
      "parameters": {
        "width": 960,
        "height": 384,
        "content": "## Document Flow:\n\n* Fetch file URL from WhatsApp message\n* Download and convert file to readable text\n* Generate embeddings with OpenAI\n* Store embeddings in Supabase for future queries"
      }
    },
    {
      "id": "1281e915-20c7-462e-9416-c980a14790c6",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        80
      ],
      "parameters": {
        "width": 560,
        "height": 544,
        "content": "## Query Flow:\n\n- Convert user query into embeddings (OpenAI)\n- Match embeddings with Supabase vectors to find context\n- Send retrieved context to Gemini 2.5 Flash for answer\n- Return concise response"
      }
    },
    {
      "id": "9a40bc48-1dbe-4ed9-9a7e-d6bf86b2e935",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        432
      ],
      "parameters": {
        "width": null,
        "height": 304,
        "content": "## Message Check: \n- Determines if the message is a query(text) or a document upload. "
      }
    },
    {
      "id": "72e122e4-f577-43ef-bf2e-e51712ef7bd9",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1168,
        208
      ],
      "parameters": {
        "width": 800,
        "height": 832,
        "content": "## Try It Out!\n### This n8n template demonstrates how to build a WhatsApp-based AI chatbot using **document retrieval (RAG)**.It stores documents in **Supabase** with **OpenAI embeddings** and generat"
      }
    },
    {
      "id": "7698302b-cba7-43ed-abbb-c6c036cd1380",
      "name": "Get Document URL",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        288,
        928
      ]
    },
    {
      "id": "9eb653ec-15c8-4854-b841-7151efe2cf9d",
      "name": "Download WhatsApp Document",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        560,
        928
      ]
    },
    {
      "id": "e0621b81-844e-4427-bee2-38ebbe0bd734",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1296,
        736
      ],
      "parameters": {
        "width": 336,
        "height": 832,
        "content": "## Document Upload Flow\n\nExample: Shows how a document is uploaded and detected in the workflow.  \n\n![Document Upload Example](https://github.com/Manav54321/WhatsApp-RAG-Chatbot-with-Supabase-Gemini-2"
      }
    },
    {
      "id": "001539b5-1ea9-4656-ad10-bf07cb77393b",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1104,
        -192
      ],
      "parameters": {
        "width": 336,
        "height": 848,
        "content": "## Contextual Answer Flow\n\nExample: Demonstrates how the bot retrieves context from Supabase and responds with Gemini 2.5 Flash.  \n\n![Contextual Answer Example](https://github.com/Manav54321/WhatsApp-"
      }
    }
  ],
  "connections": {
    "RAG Query Agent": {
      "main": [
        [
          {
            "node": "Send WhatsApp Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Document URL": {
      "main": [
        [
          {
            "node": "Download WhatsApp Document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini LLM": {
      "ai_languageModel": [
        [
          {
            "node": "RAG Query Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Convert File to Text": {
      "ai_document": [
        [
          {
            "node": "Store Embeddings in Supabase",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "New WhatsApp Message": {
      "main": [
        [
          {
            "node": "Check if Query or Document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if Query or Document": {
      "main": [
        [
          {
            "node": "RAG Query Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Document URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download WhatsApp Document": {
      "main": [
        [
          {
            "node": "Store Embeddings in Supabase",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate OpenAI Embeddings": {
      "ai_embedding": [
        [
          {
            "node": "Store Embeddings in Supabase",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "Retrieve Context from Supabase",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Store Embeddings in Supabase": {
      "main": [
        []
      ]
    },
    "Retrieve Context from Supabase": {
      "ai_tool": [
        [
          {
            "node": "RAG Query Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}