AI Email Chatbot with Hybrid RAG on Telegram using PGVector
detail.loadingPreview
Transform your email management with this intelligent AI chatbot accessible directly via Telegram. It leverages a powerful hybrid RAG approach, combining semantic search with structured database queries to give you instant, precise answers from your email archives.
About This Workflow
This n8n workflow empowers you with a sophisticated AI email assistant, making your inbox more manageable than ever. Interact directly through Telegram to ask questions about your emails and receive accurate, context-aware responses. The core of this solution lies in its innovative hybrid Retrieval Augmented Generation (RAG) system. It seamlessly integrates a PGVector store for semantic similarity searches on email content and a separate workflow for structured SQL queries against email metadata. This dual approach ensures comprehensive retrieval, whether you're looking for fuzzy concepts or precise data points. Powered by Ollama embeddings, the chatbot provides intelligent insights while carefully chunking longer responses to ensure a smooth reading experience on Telegram.
Key Features
- Telegram-Powered AI Chatbot: Interact with your email assistant directly from your Telegram app for quick, on-the-go access.
- Hybrid RAG Architecture: Combines semantic (vector) search with structured (SQL) database queries for unparalleled accuracy and versatility in email retrieval.
- Intelligent Email Search: Effortlessly find emails based on content, dates, senders, or specific details by simply asking natural language questions.
- Ollama Embeddings Integration: Utilizes self-hostable Ollama for robust text embeddings, enhancing privacy and flexibility for your RAG system.
- Adaptive Response Delivery: Automatically splits long AI responses into manageable chunks, ensuring a clear and easy-to-read experience within Telegram chats.
How To Use
- Set up Telegram Credentials: Configure your Telegram API credentials in the
Telegram TriggerandRespond on Telegram in batchesnodes. Ensure your bot token is correctly entered. - Configure Postgres Credentials: Provide your Postgres database credentials to the
Postgres PGVector Storenode. Make sure the database and tableemails_embeddingsare accessible. - Link SQL Composer Workflow: Create or import the external workflow named
Generate email SQL queries(Workflow IDAC4paL1SXMFURgmc) and link it within theCall the SQL composer Workflownode. This workflow will handle converting natural language to SQL queries. - Ollama Embeddings Setup: Configure your Ollama API credentials in the
Embeddings Ollamanode and ensure your Ollama server is running with thenomic-embed-text:latestmodel downloaded. - Initialize PGVector Store: Ensure your
emails_embeddingstable in Postgres is properly populated with email data and their corresponding embeddings generated via Ollama. - Activate Workflow: Once all credentials and external workflows are linked, activate the main workflow to start receiving and responding to email queries via Telegram.
Apps Used
Workflow JSON
{
"id": "6024a9c9-a63b-4801-a352-023b51c45341",
"name": "AI Email Chatbot with Hybrid RAG on Telegram using PGVector",
"nodes": 10,
"category": "Personal",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 6024a9c9-a63b...
About the Author
SaaS_Connector
Integration Guru
Connecting CRM, Notion, and Slack to automate your life.
Statistics
Related Workflows
Discover more workflows you might like
Smart Expense Tracking with Telegram & AI
Automate your personal finance management by turning your Telegram chat into an intelligent expense tracker. Simply send a photo of a receipt or a text message, and this workflow uses AI to categorize your spending, extract crucial details, and provide instant summaries.
Voice Task to Notion: AI-Powered Processing
This n8n workflow automates the intelligent processing of voice-activated tasks intended for Notion or similar tools. It leverages advanced AI to understand inputs, builds a dynamic knowledge base from them, and logs processing outcomes to Google Sheets. Instantly get alerted via Slack for any errors, ensuring reliable task management.
Daily AI-Powered Morning Briefing
Start your day with clarity and focus using this n8n workflow. It automatically fetches your tasks from Todoist and events from Google Calendar, then leverages AI to create a concise, personalized daily briefing delivered directly to your inbox every morning. This ensures you always know your top priorities and upcoming schedule at a glance.