Multi-Modal Conversational AI Assistant with RAG and Permanent Memory - n8n Workflow

Build a powerful conversational AI assistant using this advanced n8n workflow that leverages Telegram, Pinecone vector database, and RAG for permanent memory and retrieval. Explore n8n templates for AI.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

AI developers and engineers building sophisticated bots.
Technical users wanting to leverage RAG (Retrieval-Augmented Generation) within an n8n workflow.
Organizations needing a centralized, permanently knowledgeable internal assistant.
Automation specialists looking for advanced n8n templates involving vector databases and LLMs.

Overview

This comprehensive n8n workflow defines a two-part system: a real-time conversational agent and a scheduled RAG indexing pipeline. The conversational side uses the Telegram n8n trigger to instantly handle user input, capable of processing text, audio (via OpenAI transcription), and image data. This input is routed to an 'AI Agent' n8n node that utilizes Pinecone for permanent memory retrieval (RAG) and Deepseek/OpenAI models for generation, ensuring the bot always has the necessary context to respond accurately. The underlying learning mechanism runs on a schedule, automatically updating the knowledge base (sourced from Google Docs) and indexing it into Pinecone, making this a truly self-learning n8n workflow.

How it Works

This automation operates through two independent yet related branches, demonstrating the power of a modern n8n template.

Branch 1: Real-Time User Interaction (Conversational)


  1. Incoming Trigger: The process starts with the Telegram n8n trigger, listening for new messages.

  2. Input Routing: A Switch n8n node analyzes the message type (text, audio, or image/other) to direct the flow.

  3. Preprocessing (Audio): If an audio message is received, a Telegram n8n node downloads the file, and an OpenAI n8n node transcribes the audio into text before passing it to the agent.

  4. Preprocessing (Image): If an image is received, an OpenAI n8n node handles multimodal analysis, extracting relevant information.

  5. Agent Execution: The preprocessed text/data is fed into the central 'AI Agent' n8n node. This agent is configured with:

LLM: The Deepseek large language model.
Memory: Window Buffer Memory n8n node to maintain short-term context.
* Tools: The Pinecone Vector Store n8n node (for RAG lookup) and a Google Docs n8n node (for direct tool interaction).

  1. Response: The agent generates a final, context-aware response, which the final Telegram n8n node sends back to the user.

Branch 2: Scheduled RAG Indexing (Knowledge Update)


  1. Scheduled Trigger: This branch begins with a Schedule n8n trigger, activating periodically to refresh the knowledge base.

  2. Data Retrieval: A Google Docs n8n node fetches the specified external documents intended to be used as permanent memory.

  3. Preparation: The content is processed by a series of Langchain n8n nodes: a Default Data Loader, a Recursive Character Text Splitter (to break documents into indexable chunks), and an Embeddings OpenAI n8n node (to vectorize the data).

  4. Vector Indexing: The processed data is upserted into the Pinecone Vector Store n8n node, permanently updating the AI's long-term memory. This ensures the RAG functionality always relies on the latest documentation.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


  1. Import: Copy the provided JSON and paste it into your n8n instance using the 'Import Workflow' option.

  2. Credentials Setup: This n8n template requires connections to several external services. Ensure you set up the following credentials:

Telegram: For both the Telegram Trigger and the final Telegram output node.
OpenAI: Required for transcription, embeddings generation, and potentially multimodal analysis (OpenAI n8n node and Embeddings OpenAI n8n node).
Pinecone: Needed for both the 'query' tool and the 'indexing' upsert operation.
Google Docs: Required for accessing the documents used in the RAG indexing process.

  1. Activate Triggers: Ensure the webhook for the Telegram Trigger is active and the Schedule Trigger is configured to run at your desired interval for knowledge updates.

  2. Testing: Run the n8n workflow manually once or send a test message to your configured Telegram bot to verify all steps execute correctly.

Node Details

The core logic of this advanced n8n workflow relies on integrating specialized AI and core control flow n8n node types.

Telegram Trigger (n8n trigger): The entry point for the real-time conversation. It listens for messages, initiating the n8n workflow execution.
Switch (Core Logic n8n node): Essential for multi-modal handling. It directs the message payload down one of three paths based on whether the input contains text, audio, or image data.
OpenAI (n8n node): Used for two distinct purposes: transcribing incoming audio files (Path 2) and performing preliminary analysis on image inputs (Path 3).
AI Agent (Langchain n8n node): The central decision-maker. This powerful n8n node coordinates the LLM (Deepseek), short-term memory (Window Buffer Memory), and external tools (Pinecone RAG and Google Docs) to formulate an accurate response.
Pinecone Vector Store (Langchain n8n node): Appears twice. First, as a tool for the AI Agent (for retrieval); second, in the RAG indexing path (Pinecone Vector Store1) for upserting new knowledge.
Embeddings OpenAI (Langchain n8n node): Used in the scheduled RAG indexing branch to transform structured text chunks into vector embeddings, which are then stored in Pinecone. This is critical for the n8n workflow's permanent memory capability.


  • Recursive Character Text Splitter (Langchain n8n node): Used to prepare large documents for effective vectorization by breaking them down into appropriately sized chunks for the RAG process.

Related n8n Workflows

Paid

Nodes: 16 Nodes
Updated: December 26 2025
View all
Created by

Ph.D. in Machine Learning from the University of Toulouse. Experienced automation consultant specializing in optimizing workflows for Content creation and Marketing teams.

Featured*