Create a RAG Telegram bot using Google Drive, PostgreSQL, and local Ollama
Ready for 3.0What this workflow does
This workflow has 29 nodes and runs when an HTTP POST request hits its webhook URL (plus 1 other trigger). Along the way it connects Postgres, Telegram and Google Drive. It also calls host.docker.internal:11434 over HTTP.
How it runs
Trigger: When an HTTP POST request hits its webhook URL (plus 1 other trigger).
- Get User (Postgres): run a query
- Download File (Google Drive): download
- User State Router (Code): runs custom JavaScript code
- Extract Text (Code): runs custom JavaScript code
- Is New User? (If): checks a condition and branches into true / false
- Split Into Chunks (Code): runs custom JavaScript code
- Register New User (Postgres): run a query
- Is Verified? (If): checks a condition and branches into true / false
- Loop Chunks (Loop Over Items (Split in Batches)): loops over the items in batches
- Send PIN Request (Telegram): uses Telegram
…plus 17 more steps. See the full node list below.
Services it uses
HTTP calls to: host.docker.internal:11434
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (9)
- Webhook
n8n-nodes-base.webhook - Postgres
n8n-nodes-base.postgres - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Telegram
n8n-nodes-base.telegram - HTTP Request
n8n-nodes-base.httpRequest - Google Drive Trigger
n8n-nodes-base.googleDriveTrigger - Google Drive
n8n-nodes-base.googleDrive - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches
From the author
Who's it for This template is for developers, teams, and automation enthusiasts who want a private, PIN-protected Telegram chatbot that answers questions from their own documents — without relying on external AI APIs. Ideal for internal knowledge bases,…