Skip to main content

đź§  Empower your AI chatbot with long-term memory and dynamic tool routing

Workflow preview

Workflow preview
100%
đź§  Empower your AI chatbot with long-term memory and dynamic tool routing preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Empower Your AI Chatbot with Long Term Memory and Dynamic Tool Routing This n8n workflow equips your AI agent with long term memory and a dynamic tools router , enabling it to provide intelligent, ...

Best for

  • Support Chatbot automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.googledocs, n8n-nodes-base.set, n8n-nodes-base.telegram, n8n-nodes-base.gmail, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.toolworkflow, @n8n/n8n-nodes-langchain.memorybufferwindow

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Joseph LePage.

Original n8n.io source

1.1 Workflow description

Title
đź§  Empower your AI chatbot with long-term memory and dynamic tool routing
Workflow name
đź§  Empower your AI chatbot with long-term memory and dynamic tool routing

Empower Your AI Chatbot with Long-Term Memory and Dynamic Tool Routing

This n8n workflow equips your AI agent with long-term memory and a dynamic tools router, enabling it to provide intelligent, context-aware responses while managing tasks across multiple tools. By combining persistent memory and modular task routing, this workflow makes your AI smarter, more efficient, and highly adaptable.


👥 Who Is This For?

  1. AI Developers & Automation Enthusiasts: Integrate advanced AI features like long-term memory and task routing without coding expertise.
  2. Businesses & Teams: Automate tasks while maintaining personalized, context-aware interactions.
  3. Customer Support Teams: Improve user experience with chatbots that remember past interactions.
  4. Marketers & Content Creators: Streamline communication across platforms like Gmail and Telegram.
  5. AI Researchers: Experiment with persistent memory and multi-tool integration.

🚀 What Problem Does This Solve?

This workflow simplifies the creation of intelligent AI systems that retain memory, manage tasks dynamically, and automate notifications across tools like Gmail and Telegram—saving time and improving efficiency.


🛠️ What This Workflow Does

  • Save & Retrieve Memories: Uses Google Docs for long-term storage to recall past interactions or user preferences.
  • Dynamic Task Routing: Routes tasks to the right tools (e.g., saving/retrieving memories or sending notifications).
  • AI-Powered Context Understanding: Combines OpenAI GPT-based short-term memory with long-term memory for smarter responses.
  • Multi-Channel Notifications: Sends updates via Gmail or Telegram.

đź”§ Setup

  1. API Credentials:
    • Connect to OpenAI (AI processing), Google Docs (memory storage), Gmail/Telegram (notifications).
  2. Customize Parameters:
    • Adjust the AI agent's system message for your use case.
    • Define task-routing rules in the tools router node.
  3. Test & Deploy:
    • Verify memory saving/retrieval, task routing, and notification delivery.

đź’ˇ How to Customize

  • Modify the system message in the OpenAI node to tailor your agent’s behavior.
  • Add or adjust routing rules for additional tools.
  • Update notification settings to match your communication preferences.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - When Executed by Another Workflow

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 2 - Save Long Term Memories

Type / Role
n8n-nodes-base.googleDocs - googleDocs
Config choices
Version 2

Block 3 - Saved response

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 4 - Respond with long term memories

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 5 - Retrieve Long Term Memories3

Type / Role
n8n-nodes-base.googleDocs - googleDocs
Config choices
Version 2

Block 6 - Send Success Message to Telegram

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 7 - Email Workflow Stats

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 8 - OpenAI Chat Model2

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 9 - OpenAI Chat Model3

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 10 - 📤Send Memories to Telegram

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 1.2

Block 11 - đź“«Send Memories to Gmail

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 1.2

Block 12 - đź§ Save Memories

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 1.2

Block 13 - 🔎Retrieve Memories

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 1.2

Block 14 - 🤯Window Buffer Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 15 - đź§  AI Agent w/Long Term Memory

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.7

Block 16 - 🤖OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 17 - Ⓜ️ When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.1

Block 18 - Prepare Telegram Message

Type / Role
@n8n/n8n-nodes-langchain.chainLlm - chainLlm
Config choices
Version 1.5

Block 19 - Prepare Gmail Message

Type / Role
@n8n/n8n-nodes-langchain.chainLlm - chainLlm
Config choices
Version 1.5

Block 20 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Retrieve Long Term Memories

Type / Role
n8n-nodes-base.googleDocs - googleDocs
Config choices
Version 2

Block 22 - Memory Tool Router

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 23 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 39 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow đź§  Empower your AI chatbot with long-term memory and dynamic tool routing
Complexity advanced
Nodes 39
Categories Support Chatbot, AI Chatbot
Author Joseph LePage
Published 27 Feb 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3025/3025.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does đź§  Empower your AI chatbot with long-term memory and dynamic tool routing do?

Empower Your AI Chatbot with Long Term Memory and Dynamic Tool Routing This n8n workflow equips your AI agent with long term memory and a dynamic tools router , enabling it to provide intelligent, ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Support Chatbot, AI Chatbot use case.