AI Agent Chatbot – Long Term Memory

AI Agent Chatbot – Long Term MemoryTelegram Bots

This workflow implements an AI chat agent that receives user messages, retrieves long-term memories and notes from Google Docs, optionally saves new memories or notes, and responds via Telegram. It uses LangChain agent tools with OpenAI language models and a sliding-window memory buffer to provide context-aware, personalized replies.

What You Can Do

  • Receive chat messages via the LangChain chat trigger and process them with an AI agent
  • Retrieve long-term memories and notes from Google Docs and feed them into the agent for context
  • Save new memories or notes back to Google Docs using AI tool outputs
  • Reply to users on Telegram with formatted AI responses
  • Use a sliding-window buffer to keep recent conversational context available to the agent

Quick Start

  1. Import this workflow into n8n
  2. Configure your credentials for OpenAI, Google Docs (OAuth2), and Telegram
  3. Replace the Google Doc placeholders with your document URLs or IDs and set your Telegram chatid
  4. Activate the workflow and send a test message to verify retrieval, saving, and Telegram replies