WorkflowGoogle DocsOpen

n8n DeepSeek Telegram bot with long term memory

This n8n workflow runs a DeepSeek powered AI agent in Telegram that remembers facts about you across chats by saving them in Google Docs. It suits people who want a personal assistant bot that keeps long term memory, not only the last few messages.

What it does

A webhook receives Telegram updates, checks the user and chat ID, validates the message and routes it with a switch. The AI agent uses window buffer memory for the current talk and a Google Docs tool to read and write long term notes, then replies.

How to use it

Set the Telegram webhook with a GET request to the Bot API setWebhook URL, using your BotFather token and your HTTPS endpoint, then connect Google Docs and DeepSeek.

Requirements and limits

Only the user and chat ID you allow get answers.

More in Google Docs and the n8n workflow library.

Full text

Front matter
name: 🐋🤖 DeepSeek AI Agent + Telegram + LONG TERM Memory 🧠
description: Triggered by a webhook. Connects Condition, Google Docs, Google Docs Tool, Switch, Telegram, Webhook. # Receive Telegram Message with Webhook # How to set up a Telegram Bot WebHook ## WebHook Setup Process **Basic Concept** A WebHook allows your Telegram bot to automatically receive updates instead of manually polling the Bot API. **Setup Method** To set a WebHook, make a GET request using this URL format: ``` {{ $env.API_BASE_URL }}{my_bot_token}/setWebhook?url={url_to_send_updates_to} ``` Where: - `my_bot_token`: Your bot token from BotFather - `url_to_send_updates_to`: Your HTTPS endpoint
category: Automation
kind: Workflow
software: Condition|Google Docs|Google Docs Tool|Switch|Telegram|Webhook

🐋🤖 DeepSeek AI Agent + Telegram + LONG TERM Memory 🧠

Triggered by a webhook. Connects Condition, Google Docs, Google Docs Tool, Switch, Telegram, Webhook. # Receive Telegram Message with Webhook # How to set up a Telegram Bot WebHook

WebHook Setup Process

Basic Concept A WebHook allows your Telegram bot to automatically receive updates instead of manually polling the Bot API.

Setup Method To set a WebHook, make a GET request using this URL format:

{{ $env.API_BASE_URL }}{my_bot_token}/setWebhook?url={url_to_send_updates_to}

Where:

  • my_bot_token: Your bot token from BotFather
  • url_to_send_updates_to: Your HTTPS endpoint

Steps

  • Check User & Chat ID (if)
  • Error message (telegram)
  • Sticky Note (stickyNote)
  • Listen for Telegram Events (webhook)
  • Sticky Note1 (stickyNote)
  • Validation (set)
  • Sticky Note4 (stickyNote)
  • Message Router (switch)
  • AI Agent (noOp)
  • Merge (merge)
  • Window Buffer Memory (noOp)
  • When chat message received (noOp)
  • Sticky Note10 (stickyNote)
  • Telegram Response (telegram)
  • Save Long Term Memories (googleDocsTool)
  • Sticky Note3 (stickyNote)
  • Retrieve Long Term Memories (googleDocs)
  • Sticky Note5 (stickyNote)
  • Sticky Note6 (stickyNote)
  • Response Error message (telegram)
  • Sticky Note12 (stickyNote)
  • DeepSeek-R1 Reasoning (noOp)
  • DeepSeek-V3 Chat (noOp)

Import

Download the JSON from the GitHub source and import it in n8n (Workflows, Import from file).

Source and license

Source: https://github.com/Zie619/n8n-workflows/blob/main/Telegram/1975_Telegram_Googledocs_Automation_Webhook.md

Author: Zie619, n8n workflow collection. License: MIT.

Shown here with formatting for the web. Keep the author and license notice when you reuse it.

Related entries

There are more like this in the members library

The n8n workflow library holds 1,814 entries. Members can search all of them by meaning and read every one in full.