CORTEXFLOW · FREE FOREVER

Chatbots

Telegram Personal AI Assistant

↓ Download workflow JSON

Import in n8n: Workflows → ⋯ → Import from file, then add your credentials. Free download with a free account.

How it works

  1. Telegram Trigger receives the message — the workflow fires on every incoming Telegram message via webhook.
  2. The AI Agent reads the message — it takes the message text and sends it to the chat model with a Telegram-friendly system prompt.
  3. OpenAI generates the reply — gpt-4o-mini writes the answer (cheap and fast; swap it for any model).
  4. Window Buffer Memory keeps context — the last 10 messages are remembered per chat, keyed by Telegram chat ID, so every user gets their own continuous conversation.
  5. Send Reply posts the answer — the agent’s output is sent back to the same Telegram chat.

Set up steps

You’ll need:

  • n8n (self-hosted or cloud) with webhook access
  • A Telegram bot token — message @BotFather on Telegram, send /newbot, and copy the token it gives you
  • An OpenAI API key — get one at platform.openai.com → API keys
  1. Download the workflow JSON using the download button on this page.
  2. In n8n, go to Workflows → ⋯ → Import from file and select the JSON.
  3. Create your Telegram credential — in n8n go to Credentials → New → Telegram, paste your bot token, and save. Then open the Telegram Trigger node and the Send Reply node and select your credential in each.
  4. Create your OpenAI credential — in n8n go to Credentials → New → OpenAI, paste your API key, and save. Then open the OpenAI Chat Model node and select your credential.
  5. Activate the workflow (toggle, top-right), then send your bot a message on Telegram.

Customize it

  • Change the model — open the OpenAI Chat Model node and pick gpt-4o or any other model.
  • Change the personality — edit the system message in the AI Agent node.
  • Longer memory — raise Context Window Length in the Window Buffer Memory node.
  • Restrict access — add an IF node after the trigger checking {{$json.message.chat.id}} against your own chat ID, so only you can use the bot.

Workflow nodes

This workflow is built from 5 nodes. Here's what each one does:

#NodeTypeWhat it does
1 Telegram Trigger Telegram Trigger Starts the workflow when a Telegram message arrives.
2 AI Agent AI Agent The AI brain — reasons over the task and calls tools to get it done.
3 OpenAI Chat Model OpenAI Chat Model The language model powering the AI agent.
4 Window Buffer Memory Window Buffer Memory Gives the agent short-term chat memory across messages.
5 Send Reply Telegram Sends you a Telegram message or alert.

Setup instructions

1. Add your credentials

In n8n go to Credentials → New, create each credential below, then open the named node and select it:

NodeCredential to add
Telegram Trigger Telegram Bot API
OpenAI Chat Model OpenAI API
Send Reply Telegram Bot API

How this workflow starts

  • Telegram Trigger: Fires automatically on its event — activate the workflow and connect the service.

Use cases

You already live in Telegram, so this template puts the AI assistant in there with you: no new app, no new tab, no context switching. A Telegram Trigger fires on every message your bot receives via webhook. The AI Agent reads the message text and drafts a reply with a Telegram-friendly system prompt, gpt-4o-mini generates the answer, cheap and fast, and Window Buffer Memory keeps the last 10 messages of each conversation, keyed by Telegram chat ID, so every person gets their own continuous thread. Send Reply posts the answer back to the same chat. That is the whole workflow: a trigger, an agent, a model, memory, and a reply, plus a sticky note explaining it. It is deliberately beginner-friendly and cheap to run, and it is built for personal productivity: a pocket assistant that remembers what you were just talking about.

The freelancer's pocket research assistant

A freelance designer keeps Telegram open all day for client chats, and now the bot lives one swipe away. Between meetings she pastes in a client brief and asks for three clarifying questions to send back, or drops a long article link's worth of pasted text and asks for the key points. The Telegram-friendly system prompt keeps replies short and readable on a phone screen, and the per-chat memory means she can say now make it more formal and the bot knows what it refers to. It replaces the habit of opening a separate AI app, which is exactly the habit that never stuck.

  • Variation: edit the system message in the AI Agent node to set a personality, such as a concise editor who always replies in bullets, and every answer arrives pre-formatted.

The parent running family logistics

A parent of two coordinates groceries, school pickups, and weekend plans across a chaotic family group chat, and uses the bot as a private side channel. Add milk after an earlier we need eggs message works because the Window Buffer Memory holds the last 10 messages of that chat, so follow-ups resolve against real context. Draft a polite message to the teacher about tomorrow's early pickup turns a frazzled 9 PM thought into a sendable text. The bot never needs the family group to see the sausage being made.

  • Variation: raise the Context Window Length in the memory node if the logistics threads run long, so the bot remembers the whole week's plan instead of just the last few messages.

The solo consultant's private notes bot

A management consultant wants an AI sounding board for half-formed client ideas but will not put them in a shared tool. The bot becomes the private channel: paste the messy notes, ask what is missing, argue with the answer, refine. The customize guide's access trick makes it truly private: an IF node after the trigger checks the incoming chat ID against the consultant's own, so even if someone discovers the bot's username, only the owner can use it. Client confidentiality stays intact because the conversation never leaves a one-to-one chat.

  • Variation: set the system message to play devil's advocate, so the bot stress-tests recommendations instead of just agreeing with them.

The student's exam study partner

A final-year student preparing for competitive exams uses the bot as a quiz partner during commute hours. Explain this concept simply, then quiz me on it works across turns because the memory keeps the concept in context for the follow-up questions. Wrong answers get corrected with reference to the earlier explanation, which is the loop that makes it stick. The gpt-4o-mini model keeps each exchange fast enough that a ten-minute bus ride becomes a real study session, and cheap enough that hundreds of sessions cost almost nothing.

  • Variation: change the personality per subject in the system message: a strict examiner for revision weeks, a patient tutor for first learning.

The founder's dictation second brain

A founder thinks in bursts between meetings and loses half of them. The bot becomes the capture point: type or paste the raw idea the moment it arrives, then later ask it to summarize everything discussed this week, or to turn the three product ideas from Tuesday into a pros-and-cons list. Because each chat has its own memory, the founder keeps one chat per theme, product ideas, hiring, fundraising, and each thread stays coherent. The longer-memory variation matters here: a bigger context window turns the bot from a notepad into something closer to a chief of staff that actually remembers the quarter.

  • Variation: raise Context Window Length substantially for the ideas chat, and keep the default 10 messages for quick utility chats where long memory would only add noise.

← All templates