Skip to main content

πŸ‹πŸ€– DeepSeek AI agent + Telegram + LONG TERM memory 🧠

Workflow preview

Workflow preview
100%
πŸ‹πŸ€– DeepSeek AI agent + Telegram + LONG TERM memory 🧠 preview
Open on n8n.io

Important notice

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

1. Workflow Overview

This n8n workflow template is designed to integrate a DeepSeek AI agent with Telegram, incorporating long term memory capabilities for personalized and context aware responses. Here's a detailed br...

Best for

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

Tools used

n8n-nodes-base.if, n8n-nodes-base.telegram, n8n-nodes-base.stickynote, n8n-nodes-base.webhook, n8n-nodes-base.set, n8n-nodes-base.switch, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.merge

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
πŸ‹πŸ€– DeepSeek AI agent + Telegram + LONG TERM memory 🧠
Workflow name
πŸ‹πŸ€– DeepSeek AI agent + Telegram + LONG TERM memory 🧠

This n8n workflow template is designed to integrate a DeepSeek AI agent with Telegram, incorporating long-term memory capabilities for personalized and context-aware responses. Here's a detailed breakdown:


Core Features

Telegram Integration

  • Uses a webhook to receive messages from Telegram users.
  • Validates user identity and message content before processing.

AI-Powered Responses

  • Employs DeepSeek's AI models for conversational interactions.
  • Includes memory capabilities to personalize responses based on past interactions.

Error Handling

  • Sends an error message if the input cannot be processed.

Model Options 🧠

  • DeepSeek-V3 Chat: Handles general conversational tasks.
  • DeepSeek-R1 Reasoning: Provides advanced reasoning capabilities for complex queries.
  • Memory Buffer Window: Maintains session context for ongoing conversations.

Quick Setup πŸ› οΈ

Telegram Webhook Configuration

  1. Set up a webhook using the Telegram Bot API:
    https://api.telegram.org/bot{my_bot_token}/setWebhook?url={url_to_send_updates_to}
    
    Replace {my_bot_token} with your bot's token and {url_to_send_updates_to} with your n8n webhook URL.
  2. Verify the webhook setup using:
    https://api.telegram.org/bot{my_bot_token}/getWebhookInfo
    

DeepSeek API Configuration

  1. Base URL: https://api.deepseek.com
  2. Obtain your API key from the DeepSeek platform.

Implementation Details πŸ”§

User Validation

  • The workflow validates the user's first name, last name, and ID using data from incoming Telegram messages.
  • Only authorized users proceed to the next steps.

Message Routing

  • Routes messages based on their type (text, audio, or image) using a switch node.
  • Ensures appropriate handling for each message format.

AI Agent Interaction

  • Processes text input using DeepSeek-V3 or DeepSeek-R1 models.
  • Customizable system prompts define the AI's behavior and rules, ensuring user-centric and context-aware responses.

Memory Management

  • Retrieves long-term memories stored in Google Docs to enhance personalization.
  • Saves new memories based on user interactions, ensuring continuity across sessions.

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 - Check User & Chat ID

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 2 - Error message

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

Block 3 - Sticky Note

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

Block 4 - Listen for Telegram Events

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

Block 5 - Sticky Note1

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

Block 6 - Validation

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

Block 7 - Sticky Note4

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

Block 8 - Message Router

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

Block 9 - AI Agent

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

Block 10 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3

Block 11 - Window Buffer Memory

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

Block 12 - When chat message received

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

Block 13 - Sticky Note10

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

Block 14 - Telegram Response

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

Block 15 - Save Long Term Memories

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

Block 16 - Sticky Note3

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

Block 17 - Retrieve Long Term Memories

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

Block 18 - Sticky Note5

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

Block 19 - Sticky Note6

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

Block 20 - Response Error message

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

Block 21 - Sticky Note12

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

Block 22 - DeepSeek-R1 Reasoning

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

Block 23 - DeepSeek-V3 Chat

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

3. Summary Table

Workflow πŸ‹πŸ€– DeepSeek AI agent + Telegram + LONG TERM memory 🧠
Complexity advanced
Nodes 23
Categories Personal Productivity, AI Chatbot
Author Joseph LePage
Published 08 Feb 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/2864/2864.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 πŸ‹πŸ€– DeepSeek AI agent + Telegram + LONG TERM memory 🧠 do?

This n8n workflow template is designed to integrate a DeepSeek AI agent with Telegram, incorporating long term memory capabilities for personalized and context aware responses. Here's a detailed br...

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 Personal Productivity, AI Chatbot use case.