Build a Secure Telegram Bot with n8n & Google Drive Integration
Build a Secure Telegram Bot with n8n & Google Drive Integration
Couldn't load pickup availability
Build a Secure Telegram Bot with n8n & Google Drive Integration
Transform your private documents into an intelligent, secure Telegram chatbot that answers questions using your own local AI models—no external APIs required. This n8n workflow combines document ingestion from Google Drive with a PIN-protected Telegram bot powered by Ollama's local LLM stack.
What this workflow does
Two parallel automation flows work seamlessly together:
- Document Ingestion: Monitors your designated Google Drive folder for new files, automatically downloads them, splits content into 500-character chunks with 50-character overlap, creates embeddings using Ollama's nomic-embed-text model, and stores everything in PostgreSQL with pgvector extension
- Telegram Bot Interface: Handles user registration with PIN verification, processes natural language questions, retrieves the top 5 most relevant document chunks via cosine similarity search, and generates contextual answers using qwen2.5:7b model—all while logging interactions for analysis
Perfect use cases
- Internal knowledge bases for teams who need secure document search without cloud AI dependencies
- Private document Q&A systems for sensitive company information
- Local LLM implementations where data privacy is paramount
- Custom chatbots for organizations running their own AI infrastructure with Ollama
Technical implementation
Built with essential n8n nodes including PostgreSQL database integration, Telegram bot webhook handling, Google Drive OAuth2 connectivity, conditional logic flows, and custom code execution. The workflow leverages pgvector for efficient similarity search and integrates seamlessly with your existing Ollama installation.
Setup requirements
Complete setup instructions included: enable pgvector extension in PostgreSQL with provided SQL scripts, install Ollama with required models (nomic-embed-text and qwen2.5:7b), configure n8n credentials for Telegram Bot token from @BotFather, PostgreSQL connection, and Google Drive OAuth2 authentication.
Ideal for developers, automation teams, and organizations prioritizing data security while building intelligent document search capabilities with full control over their AI stack.
