Skip to content
FlowHubFluxonLab
A
AI Automationfree

Chat with Your Email History using Telegram, Mistral and Pgvector for RAG

by Alfonso Correttiadapted from n8n official workflow galleryUpdated Aug 2026
RequiresAAI AgentCall n8n Workflow ToolCall n8n Workflow ToolCCodeEmbeddings OllamaEmbeddings OllamaOpenAI Chat ModelOpenAI Chat ModelPostgres PGVector StorePostgres PGVector StoreSSimple MemoryTelegramTelegram
Share Post Share
Telegram TriggerSILoop Over ItemsIfCame from Telegram?Came from Teleg…ChWhen chat message receivedWhen chat messa…VSPostgres PGVector StorePostgres PGVect…TWCall the SQL composer WorkflowCall the SQL co…EOEmbeddings OllamaEmbeddings Olla…SeBeautify chat responseBeautify chat r…CoSplit text into chunksSplit text into…Respond on Telegram in batchesRespond on Tele…CoEscape MarkdownNONo Operation, do nothingNo Operation, d…MBSimple MemoryAgAI AgentOpenAI Chat ModelOpenAI Chat Mod…SeGenerate session idGenerate sessio…12345678910111213141516
1/5
STEPS · 16
Starts on a Telegram event

Who is this for? Everyone! Did you dream of asking an AI "what hotel did I stay in for holidays last summer?" or "what were my marks last semester like?". Dream no more, as vector similarity searches and this workflow are the foundations to make it possible (as long as the information appears in your e-mails 😅). 100% Local and Open Source! This workflow is designed to use locally-hosted open source. Ollama as LLM provider, nomic-embed-text as the embeddings model, and pgvector as the vector database engine, on top of Postgres. Structured AND Vectorized This workflow combines structured and semantic search on your e-mail. No need for enterprise setups! Leverage the convenience of n8n and open source to get a bleeding edge solution. Setup You will need a PGVector database with embeddings for all your email. Use my other template Gmail to Vector Embeddings with PGVector and Ollama to set it up in a breeze! Make a copy of my Email Assistant: Convert Natural Language to SQL Queries with Phi4-mini and PostgreSQL, you will need it for structured searches. Install this template and modify the Call the SQL composer Workflow step, to point at your copy of the SQL workflow.

Tags

n8nreference-onlyagentembeddings-ollamalm-chat-open-aimemory-buffer-windowtelegramtool-workflowvector-store-pgvector
Connects
AAI Agentcalln8nworkflowtoolCall n8n Workflow ToolCCodeembeddingsollamaEmbeddings OllamaopenaichatmodelOpenAI Chat ModelpostgrespgvectorstorePostgres PGVector Store
CategoryAI Automation
Triggermanual
Complexitycomplex
Nodes16
AddedApr 27, 2025

Related workflows

See all AI Automation
AopenaichatmodelserpapigooglesearchS
free

Slack chatbot powered by AI

This workflow offers an effective way to handle a chatbot's functionality, making use of multiple tools for information retrieval, conversation context storage, and message sending. It's a setup tailored for a Slack environment, aiming to offer an interactive, AI-driven chatbot experience. Note that to use this template, you need to be on n8n version 1.19.4 or later.

by n8n Team
AopenaichatmodelserpapigooglesearchS
free

AI agent chat

This workflow employs OpenAI's language models and SerpAPI to create a responsive, intelligent conversational agent. It comes equipped with manual chat triggers and memory buffer capabilities to ensure seamless interactions. To use this template, you need to be on n8n version 1.50.0 or later.

by n8n Team
AopenaichatmodelserpapigooglesearchS
free

AI chatbot that can search the web

This workflow is designed for dynamic and intelligent conversational capabilities. It incorporates OpenAI's GPT-4o model for natural language understanding and generation. Additional tools include SerpAPI and Wikipedia for enriched, data-driven responses. The workflow is triggered manually, and utilizes a 'Window Buffer Memory' to maintain the context of the last 20 interactions for better conversational continuity. All these components are orchestrated through n8n nodes, ensuring seamless interconnectivity. To use this template, you need to be on n8n version 1.50.0 or later.

by n8n Team