AutomationFlowsAI & RAG › Telegram AI Chatbot with DeepSeek

Telegram AI Chatbot with DeepSeek

Original n8n title: Moss

moss. Uses telegramTrigger, n8nTrainingCustom, agent, lmChatDeepSeek. Event-driven trigger; 12 nodes.

Event trigger★★★★☆ complexityAI-powered12 nodesTelegram TriggerN8N Training CustomAgentLm Chat Deep SeekMemory Buffer WindowTelegram
AI & RAG Trigger: Event Nodes: 12 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Lmchatdeepseek recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "moss",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "id": "node-telegram-trigger",
      "name": "telegram trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.1,
      "position": [
        0,
        300
      ],
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const msg = $input.first().json;\nconst chatId = String(msg.message.chat.id);\nconst text = msg.message.text || '';\nconst firstName = msg.message.from.first_name || '';\nconst username = msg.message.from.username || '';\nreturn [{ json: { chatId, text, firstName, username } }];"
      },
      "id": "node-extract",
      "name": "extract message",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        220,
        300
      ]
    },
    {
      "parameters": {
        "operation": "getAll",
        "tableId": "user_profiles",
        "filters": {
          "conditions": [
            {
              "keyName": "chat_id",
              "keyValue": "={{ $json.chatId }}"
            }
          ]
        },
        "options": {
          "limit": 1
        }
      },
      "id": "node-read-profile",
      "name": "read profile",
      "type": "n8n-nodes-base.n8nTrainingCustom",
      "typeVersion": 1,
      "position": [
        440,
        300
      ],
      "continueOnFail": true
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "leftValue": "={{ $json.profile || '' }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              }
            }
          ],
          "combinator": "and"
        }
      },
      "id": "node-check-profile",
      "name": "has profile?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        660,
        300
      ]
    },
    {
      "parameters": {
        "agent": "conversationalAgent",
        "promptType": "define",
        "text": "={{ $('extract message').item.json.text }}",
        "options": {
          "systemMessage": "you are moss, a personal AI assistant.\n\nthis user is new. your job right now is onboarding \u2014 help them set up their profile.\n\nstart with a warm, brief greeting. then ask them to tell you about themselves: who they are, what they do, what they care about, how they like to communicate. keep it open-ended \u2014 don't use a rigid questionnaire. let them share what they want.\n\nonce they've shared enough (at least name + some context about their life/work), confirm what you've understood and tell them you're ready to help.\n\nkeep your tone direct and natural. no corporate filler phrases."
        }
      },
      "id": "node-onboarding-agent",
      "name": "onboarding agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        880,
        480
      ]
    },
    {
      "parameters": {
        "agent": "conversationalAgent",
        "promptType": "define",
        "text": "={{ $('extract message').item.json.text }}",
        "options": {
          "systemMessage": "=you are moss, a personal AI assistant.\n\n## what you know about this user\n{{ $('read profile').item.json.profile || 'no profile yet' }}\n\n## how to behave\n- direct and efficient. skip filler phrases like \"of course!\" or \"great question!\"\n- have opinions. you can disagree and push back\n- reply in the same language the user writes in\n- use structured output (bullets, tables) for complex answers\n- remember what the user tells you during this conversation\n- be precise with numbers and claims \u2014 especially anything finance-related\n\n## your purpose\nhelp this user think better, work faster, and get things done. you have access to their calendar, tasks, and preferences. use that context proactively."
        }
      },
      "id": "node-main-agent",
      "name": "main agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        880,
        160
      ]
    },
    {
      "parameters": {
        "model": "deepseek-chat",
        "options": {
          "temperature": 0.7,
          "maxTokens": 1500
        }
      },
      "id": "node-llm-main",
      "name": "llm for main",
      "type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
      "typeVersion": 1,
      "position": [
        780,
        0
      ],
      "credentials": {
        "deepSeekApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "deepseek-chat",
        "options": {
          "temperature": 0.7,
          "maxTokens": 1500
        }
      },
      "id": "node-llm-onboarding",
      "name": "llm for onboarding",
      "type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
      "typeVersion": 1,
      "position": [
        780,
        620
      ],
      "credentials": {
        "deepSeekApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('extract message').item.json.chatId }}"
      },
      "id": "node-memory-main",
      "name": "memory main",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        980,
        0
      ]
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "=onboarding_{{ $('extract message').item.json.chatId }}"
      },
      "id": "node-memory-onboarding",
      "name": "memory onboarding",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        980,
        620
      ]
    },
    {
      "parameters": {
        "jsCode": "const mainOutput = $('main agent').item?.json?.output || '';\nconst onboardingOutput = $('onboarding agent').item?.json?.output || '';\nconst reply = mainOutput || onboardingOutput;\nconst chatId = $('extract message').item.json.chatId;\nreturn [{ json: { reply, chatId } }];"
      },
      "id": "node-merge-reply",
      "name": "merge reply",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1100,
        300
      ]
    },
    {
      "parameters": {
        "chatId": "={{ $json.chatId }}",
        "text": "={{ $json.reply }}",
        "additionalFields": {}
      },
      "id": "node-send-reply",
      "name": "send reply",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1320,
        300
      ],
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "telegram trigger": {
      "main": [
        [
          {
            "node": "extract message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "extract message": {
      "main": [
        [
          {
            "node": "read profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "read profile": {
      "main": [
        [
          {
            "node": "has profile?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "has profile?": {
      "main": [
        [
          {
            "node": "main agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "onboarding agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "main agent": {
      "main": [
        [
          {
            "node": "merge reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "onboarding agent": {
      "main": [
        [
          {
            "node": "merge reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "merge reply": {
      "main": [
        [
          {
            "node": "send reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "llm for main": {
      "ai_languageModel": [
        [
          {
            "node": "main agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "llm for onboarding": {
      "ai_languageModel": [
        [
          {
            "node": "onboarding agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "memory main": {
      "ai_memory": [
        [
          {
            "node": "main agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "memory onboarding": {
      "ai_memory": [
        [
          {
            "node": "onboarding agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

moss. Uses telegramTrigger, n8nTrainingCustom, agent, lmChatDeepSeek. Event-driven trigger; 12 nodes.

Source: https://github.com/sethlsx/moss/blob/bd15b4f7f5068f0e2c54318448815e98681cfc28/workflows/moss.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

BoomerBobBot.TP. Uses agent, telegramTrigger, telegram, memoryBufferWindow. Event-driven trigger; 95 nodes.

Agent, Telegram Trigger, Telegram +10
AI & RAG

An n8n workflow automating business travel planning via Telegram. Uses AI and APIs to find and book flights/hotels efficiently. Telegram Bot (BotFather) API Keys: OpenAI (transcription), SerpAPI (flig

Telegram, OpenAI, Information Extractor +6
AI & RAG

This workflow is perfect for anyone who wants to receive AI-powered research summaries directly on Telegram. Ideal for people asking frequent product, tech, or decision-making questions and want up-to

Agent, Lm Chat Deep Seek, Memory Buffer Window +4
AI & RAG

Telegram Trigger receives incoming messages (text, voice, photo, document). Switch routes by message type to appropriate processors: Text → forwarded as-is. Voice → downloaded and sent to Transcribe a

Memory Buffer Window, Telegram Trigger, Telegram +12
AI & RAG

Transform your Telegram messenger into a powerful, multi-modal personal or team assistant. This n8n workflow creates an intelligent agent that can understand text, voice, images, and documents, and ta

Memory Buffer Window, Telegram Trigger, Telegram +10