Skip to main content

RAG chatbot with Supabase + TogetherAI + Openrouter

Workflow preview

Workflow preview
100%
RAG chatbot with Supabase + TogetherAI + Openrouter preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

️ RUN the FIRST WORKFLOW ONLY ONCE (as it will convert your content in Embedding format and save it in DB and is ready for the RAG Chat) Telegram Trigger Type: Purpose: Waits for new Telegram m...

Best for

  • Internal Wiki automation workflows
  • AI RAG automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.googledocs, n8n-nodes-base.code, n8n-nodes-base.httprequest, n8n-nodes-base.supabase, n8n-nodes-base.telegramtrigger, @n8n/n8n-nodes-langchain.chattrigger, n8n-nodes-base.aggregate, @n8n/n8n-nodes-langchain.chainllm

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by iamvaar.

Original n8n.io source

1.1 Workflow description

Title
RAG chatbot with Supabase + TogetherAI + Openrouter
Workflow name
RAG chatbot with Supabase + TogetherAI + Openrouter

⚠️ RUN the FIRST WORKFLOW ONLY ONCE

(as it will convert your content in Embedding format and save it in DB and is ready for the RAG Chat)

📌 Telegram Trigger

  • Type: telegramTrigger
  • Purpose: Waits for new Telegram messages to trigger the workflow.
  • Note: Currently disabled.

📄 Content for the Training

  • Type: googleDocs
  • Purpose: Fetches document content from Google Docs using its URL.
  • Details: Uses Service Account authentication.

✂️ Splitting into Chunks

  • Type: code
  • Purpose: Splits the fetched document text into smaller chunks (1000 chars each) for processing.
  • Logic: Loops over text and slices it.

🧠 Embedding Uploaded Document

  • Type: httpRequest
  • Purpose: Calls Together AI embedding API to get vector embeddings for each text chunk.
  • Details: Sends JSON with model name and chunk as input.

🛢 Save the embedding in DB

  • Type: supabase
  • Purpose: Saves each text chunk and its embedding vector into the Supabase embed table.

SECOND WORKFLOW EXPLAINATION:

💬 When chat message received

  • Type: chatTrigger
  • Purpose: Starts the workflow when a user sends a chat message.
  • Details: Sends an initial greeting message to the user.

🧩 Embend User Message

  • Type: httpRequest
  • Purpose: Generates embedding for the user’s input message.
  • Details: Calls Together AI embeddings API.

🔍 Search Embeddings

  • Type: httpRequest
  • Purpose: Searches Supabase DB for the top 5 most similar text chunks based on the generated embedding.
  • Details: Calls Supabase RPC function matchembeddings1.

📦 Aggregate

  • Type: aggregate
  • Purpose: Combines all retrieved text chunks into a single aggregated context for the LLM.

🧠 Basic LLM Chain

  • Type: chainLlm
  • Purpose: Passes the user's question + aggregated context to the LLM to generate a detailed answer.
  • Details: Contains prompt instructing the LLM to answer only based on context.

🤖 OpenRouter Chat Model

  • Type: lmChatOpenRouter
  • Purpose: Provides the actual AI language model that processes the prompt.
  • Details: Uses qwen/qwen3-8b:free model via OpenRouter and you can use any of your choice.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Content for the Training

Type / Role
n8n-nodes-base.googleDocs - googleDocs
Config choices
Version 2

Block 2 - Splitting into Chunks

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 3 - Embedding Uploaded document

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 4 - Save the embedding in DB

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 5 - Telegram Trigger

Type / Role
n8n-nodes-base.telegramTrigger - telegramTrigger
Config choices
Version 1.2

Block 6 - When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.1

Block 7 - Aggregate

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 8 - Basic LLM Chain

Type / Role
@n8n/n8n-nodes-langchain.chainLlm - chainLlm
Config choices
Version 1.7

Block 9 - OpenRouter Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 10 - Search Embeddings

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 11 - Embend User Message

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 12 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow RAG chatbot with Supabase + TogetherAI + Openrouter
Complexity intermediate
Nodes 13
Categories Internal Wiki, AI RAG
Author iamvaar
Published 04 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/5680/5680.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does RAG chatbot with Supabase + TogetherAI + Openrouter do?

️ RUN the FIRST WORKFLOW ONLY ONCE (as it will convert your content in Embedding format and save it in DB and is ready for the RAG Chat) Telegram Trigger Type: Purpose: Waits for new Telegram m...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Internal Wiki, AI RAG use case.