Animated data flow diagram

AI Chatbot Agent: Long-Term Memory & Note Storage via Google Docs & Telegram

Version: 1.0.0 | Last Updated: 2025-05-16

Integrates with:

OpenAI Google Docs Telegram DeepSeek

Overview

Unlock Persistent, Personalized Conversations with this AI Agent

This n8n workflow empowers you to deploy a sophisticated AI Chatbot Agent capable of maintaining long-term memory and taking notes. It integrates with Large Language Models (LLMs) like OpenAI's GPT series to understand and respond to user inputs, while leveraging Google Docs as a persistent knowledge base for memories and notes. Engage users with a chatbot that learns and remembers across interactions.

This AI Agent's core abilities include: Conversational AI, Long-Term Memory Management, and Intelligent Note-Taking.

Key Features & Benefits

  • AI-Driven Conversations: Utilizes LLMs (e.g., GPT-4o mini, configurable for others like DeepSeek) for natural and intelligent chat interactions.
  • Long-Term Memory: Saves and retrieves important user information and conversation context from a designated Google Document, enabling personalized follow-ups.
  • Note Storage: Allows the agent (or user via the agent) to save specific pieces of information as notes in a separate Google Document for easy retrieval.
  • Telegram Integration: Seamlessly connects with Telegram for receiving messages and sending AI-generated responses.
  • Customizable Persona & Rules: A detailed system prompt guides the AI's behavior, memory management, and note-taking logic, which you can tailor to your specific needs.
  • Short-Term Context Window: Maintains a buffer of recent messages for immediate conversational context.
  • Extensible Toolset: The agent uses defined tools ('Save Memory', 'Save Note') that interact with Google Docs, and this can be expanded.

Use Cases

  • Deploying a B2C e-commerce customer support bot that remembers past purchases and preferences for tailored assistance.
  • Creating an internal B2B SaaS knowledge assistant that learns from team interactions and documents solutions in Google Docs.
  • Building a personal AI assistant for solopreneurs to manage client notes, project details, and recall information on demand.
  • Automating lead qualification via a Telegram chatbot that stores prospect information and conversation history for sales teams.

Prerequisites

  • An n8n instance (Cloud or self-hosted).
  • OpenAI API Key (e.g., for gpt-4o-mini).
  • (Optional) DeepSeek API Key if you plan to use the DeepSeek model.
  • Google API credentials with access to Google Docs.
  • Specific Google Document URLs (or IDs) for storing long-term memories and notes.
  • Telegram Bot API Token and a Chat ID for sending/receiving messages.

Setup Instructions

  1. Download the n8n workflow JSON file.
  2. Import the workflow into your n8n instance.
  3. Configure the 'When chat message received' (Chat Trigger) node. If using Telegram, ensure your Telegram Trigger node is set up if this node acts as a generic interface.
  4. Configure the 'gpt-4o-mini' (OpenAI) node and optionally the 'DeepSeek-V3 Chat' node with your respective API keys and desired model parameters.
  5. Update the 'Retrieve Long Term Memories', 'Save Long Term Memories', 'Retrieve Notes', and 'Save Notes' (Google Docs) nodes: replace placeholder [Google Doc ID] in the 'Document URL' field with your actual Google Document URLs or IDs. Ensure your Google Docs credentials are correctly configured.
  6. Customize the system prompt within the 'AI Tools Agent' node to define your AI's persona, rules, and how it should handle memories and notes.
  7. Configure the 'Telegram Response' node with your Telegram Bot API token (if not globally set) and the target Chat ID (replace placeholder 1234567891).
  8. Review and adjust the 'Window Buffer Memory' node settings if needed (e.g., context window length).
  9. Activate the workflow and test by sending a message via your configured chat interface (e.g., Telegram).

Tags:

AI AgentChatbotLong-Term MemoryGoogle DocsTelegramOpenAILLMAutomationCustomer Support

Want your own unique AI agent?

Talk to us - we know how to build custom AI agents for your specific needs.

Schedule a Consultation