Deploy a powerful AI Agent chatbot using this advanced n8n workflow. Integrates LangChain memory, Google Docs for long-term data storage, and Telegram communication for personalized, contextual interactions.
Download this n8n workflow template and start using it instantly.
Automation Specialists needing complex, stateful AI solutions.
Users looking for high-performance n8n templates for AI chatbots.
Developers requiring custom long-term memory storage mechanisms (Google Docs, databases).
Businesses aiming to create personalized customer service or internal knowledge retrieval agents.
This sophisticated n8n workflow demonstrates how to build a robust, conversational AI agent that maintains long-term memory and specific user notes, allowing for truly personalized interactions. Unlike simple chatbots, this architecture uses Google Docs as a persistent data store for memory and notes, ensuring the AI retains context across sessions. The system is initiated by a user message through a chat service (like Telegram). Before responding, the n8n automation retrieves all relevant historical context, feeds it into the AI Tools Agent n8n node, and then allows the AI to decide whether to simply respond, or use the Save Memory or Save Note tools. This approach makes this specific n8n workflow highly effective for retaining personal preferences, objectives, and ongoing project details. If you are searching for complex n8n templates that showcase the full power of LangChain integration within n8n, this solution is ideal.
The core of this n8n workflow revolves around robust context management and intelligent tooling:
When chat message received n8n trigger, capturing a user's incoming message (likely from Telegram). Immediately, the workflow executes two parallel paths: Retrieve Long Term Memories and Retrieve Notes from Google Docs.Merge and Aggregate n8n nodes, ensuring all historical context is presented to the AI.AI Tools Agent n8n node. This agent, governed by detailed system instructions, uses the context, short-term conversational history (via the Window Buffer Memory n8n node), and its available Large Language Models (gpt-4o-mini or DeepSeek-V3 Chat) to formulate a plan.Save Long Term Memories: Used if the input contains generalized personal information (preferences, habits).Save Notes: Used if the input is a specific instruction or reminder.Chat Response n8n node and then transmitted back to the user via the Telegram Response n8n node. This full loop ensures that the current conversation contributes to the long-term context stored in the persistent memory documents, making this a highly adaptive n8n workflow.To deploy this comprehensive n8n workflow, follow these steps:
gpt-4o-mini or DeepSeek-V3 Chat). Note that DeepSeek uses an OpenAI API-compatible interface.Retrieve Long Term Memories, Retrieve Notes, Save Long Term Memories, and Save Notes n8n nodes, replace the placeholder [Google Doc ID] with the actual Document IDs where memories and notes are stored. These documents serve as the database for the n8n workflow.chatId field in the Telegram Response n8n node with your specific target chat ID.When chat message received n8n trigger will now be listening for new messages. When chat message received (LangChain Chat Trigger): The starting n8n trigger for the entire automation. It listens for incoming chat messages to initiate the AI conversation sequence.
Retrieve Long Term Memories / Retrieve Notes (Google Docs Node): These n8n nodes are crucial for persistent memory. They perform a Get operation to fetch the existing conversational history and user notes from their respective Google Docs files, which are then injected into the AI context.
AI Tools Agent (LangChain Agent Node): This is the central brain of the n8n workflow. It uses a complex systemMessage defining its personality, rules, and how it must interact with the memory system and tools. It decides whether to generate a response or utilize one of the connected tools.
Window Buffer Memory (LangChain Memory Node): Provides short-term context for the current conversation session. It is configured to use the sessionId provided by the initial n8n trigger.
gpt-4o-mini / DeepSeek-V3 Chat (LangChain LLM Nodes): These models serve as the Large Language Model engine for the AI agent, providing the generative capabilities needed to process requests and utilize tools.
Save Long Term Memories / Save Notes (Google Docs Tool Node): These n8n nodes act as custom tools for the AI agent. They perform an Insert operation to append new, summarized memory or note data into the designated Google Docs file based on the agent's decision ($fromAI('memory')), effectively managing the long-term state of the n8n workflow.
Automate community leaderboard reporting using an n8n workflow. This solution aggregates creator stats, generates insightful reports via OpenAI/Gemini AI agents, and delivers results via Gmail and Google Drive.

Use this powerful n8n workflow to automate logistics management. It leverages an AI n8n node to extract structured data from Gmail shipment requests, calculates geocoding and routes using Open Route API, tracks everything in Google Sheets, and sends professional automated replies. Discover more complex n8n templates for logistics.

Automate web research using this powerful n8n workflow. It combines the Tavily Search API for finding relevant links and extracting content, then uses OpenAI to summarize the results into clean, actionable insights.

Use this modular n8n workflow template to accurately track and calculate the cost of AI model token consumption (like JinaAI or OpenAI). Logs execution details directly into Google Sheets for financial monitoring.


As an AI Automation consultant based in Canada, I partner with forward-thinking organizations to implement AI solutions that streamline operations and drive growth.







































