FlowStep
← All walkthroughs
Full libraryTelegramOpenAI

Build a Telegram AI assistant you can chat with

Wire a Telegram bot to an AI model so anyone in the chat gets a written answer back in seconds, with memory of the last few messages.

25 minIntermediate13 steps

What this looks like

One step on screen at a time. Read it, do it, tap Next.

Build a Telegram AI assistant you can chat with

Step 1 of 13

01 / 13Step

Create the bot in Telegram

Open Telegram and start a chat with @BotFather. Send /newbot, then answer the two questions: a display name, and a username that must end in bot.

Checkpoint

You have a token that looks like a long number, a colon, then a random string.

Back
Next

Before you begin

Tick these off as you sort them. Stopping halfway to create an account is how a fifteen-minute build becomes an hour.

0 of 8 ready

Ticks are saved on this device, so you can come back to them.

  • Account

    You create the bot from inside Telegram itself by messaging @BotFather. The phone app or desktop app both work.

  • API key

    Message @BotFather, send /newbot, follow the two prompts, and copy the long token it hands back. Treat it like a password.

  • API key

    An OpenAI key works out of the box. Any provider n8n supports will do — the node changes but the shape of the workflow does not.

  • Permission

    Model calls fail with a quota error if the account has no credit. Check this before you start rather than while debugging.

  • Time

    Creating the bot takes two minutes. Most of the rest is tuning the system prompt so the replies sound the way you want.

The basics — ticked once, remembered everywhere

  • Account

    Either the hosted version or a self-hosted install. Everything here works the same on both — the only visible difference is the shape of your webhook URLs.

    Create a workspace
  • Know-how

    Adding a node, connecting two of them, and pressing Execute. If any of that is new, the free primer covers it in about ten minutes.

  • Credential

    You will paste at least one secret during setup. A password manager beats a notes app, and it stops you pasting a live key into a chat window by accident.

The shape of the workflow

The nodes you will end up with, left to right, in the order you add them.

Telegram TriggerAI AgentOpenAI Chat ModelAI AgentSimple MemoryTelegram
The finished Build a Telegram AI assistant you can chat with workflow on the n8n canvas4 things to set here
  1. 1Create the bot in Telegramthe trigger — everything starts here
  2. 2Telegram TriggerCreate a new workflow and add the Telegram Trigger
  3. 3Telegram TriggerAdd the Telegram credential
  4. 4Telegram TriggerCapture a real message
The finished workflow on the n8n canvasTap to enlarge

Skip the node hunting

Import a starter file with every node for this build already on the canvas, named after its step and wired in order, each one carrying a sticky note with the values to enter. You still connect your own accounts and fill the fields — that is what the walkthrough takes you through — but you never start at a blank canvas.

In n8n: Workflows → Import from file.

Included with the library

What you will build

Jump straight to any step, or print the list and tick it off beside your n8n tab.

If something goes wrong

Everything ready?

Start walkthrough