Skip to main content

Document Q&A chatbot with Gemini AI and Supabase vector search for Telegram

Workflow preview

Workflow preview
100%
Document Q&A chatbot with Gemini AI and Supabase vector search for Telegram preview
Open on n8n.io

Important notice

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

1. Workflow Overview

This template creates a Telegram AI Assistant that answers questions based on your documents, powered by Google Gemini and Supabase. Key features include Intelligent HTML Post processing for rich f...

Best for

  • Personal Productivity automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.lmchatgooglegemini, n8n-nodes-base.openweathermaptool, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.telegramtrigger, n8n-nodes-base.telegram, @n8n/n8n-nodes-langchain.toolthink, @n8n/n8n-nodes-langchain.embeddingsgooglegemini, @n8n/n8n-nodes-langchain.documentdefaultdataloader

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Document Q&A chatbot with Gemini AI and Supabase vector search for Telegram
Workflow name
Document Q&A chatbot with Gemini AI and Supabase vector search for Telegram

This template creates a Telegram AI Assistant that answers questions based on your documents, powered by Google Gemini and Supabase. Key features include Intelligent HTML Post-processing for rich formatting in Telegram and Adaptive Message Chunking to handle long text responses.

๐Ÿ“น Watch the Bot in Action

โ–ถ๏ธ Click the image above to watch a live demo on YouTube.

This video provides a live demonstration of the bot's core features and how it interacts. See a quick walkthrough of its capabilities and user flow.

How it works:

  • User uploads a PDF document to a Telegram bot.

  • The workflow processes the PDF, creates embeddings using Google Gemini, and stores these embeddings in a Supabase vector table.

  • Users then ask questions to the bot.

  • The workflow performs a vector search in Supabase to find relevant document chunks based on the user's query.

  • Google Gemini uses the retrieved relevant chunks to generate an intelligent answer.

  • The bot sends the formatted answer back to the user on Telegram, utilizing HTML markup for enhanced presentation.

Set up steps:

Setup should take approximately 15-20 minutes.

  1. Import the workflow into your n8n instance.

  2. Configure credentials for Telegram, Google Gemini, and Supabase.

  3. Set up your Supabase vector table using the provided SQL script.

  4. Activate the workflow.

Detailed setup instructions, including how to get API keys and configure nodes, are available in the sticky notes within the workflow itself.

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 - Google Gemini Chat Model

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

Block 2 - OpenWeatherMap

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

Block 3 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.9

Block 4 - Telegram Trigger

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

Block 5 - Telegram

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

Block 6 - Think

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

Block 7 - Embeddings Google Gemini

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

Block 8 - Default Data Loader

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

Block 9 - Recursive Character Text Splitter

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

Block 10 - Extract from File

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

Block 11 - Answer questions with a vector store

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

Block 12 - Supabase Vector Store

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

Block 13 - Sticky Note10

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

Block 14 - Sticky Note11

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

Block 15 - Telegram - Embedding Complete

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

Block 16 - Supabase - Save Embeddings

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

Block 17 - Command Router

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 18 - Telegram - Download file

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

Block 19 - Aggregate

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

Block 20 - Fallback- No formatting

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

Block 21 - Split Out

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

Block 22 - Simple Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 23 - Handle formatting and split

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

Block 24 - Sticky Note

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

Showing the first 24 of 28 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Document Q&A chatbot with Gemini AI and Supabase vector search for Telegram
Complexity advanced
Nodes 28
Categories Personal Productivity, AI RAG
Author Mohammad Ghaffarifar
Published 08 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3940/3940.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 Document Q&A chatbot with Gemini AI and Supabase vector search for Telegram do?

This template creates a Telegram AI Assistant that answers questions based on your documents, powered by Google Gemini and Supabase. Key features include Intelligent HTML Post processing for rich f...

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 Personal Productivity, AI RAG use case.