Guide

The Telegram Bot API in plain words: how a bot receives your messages, files and group chats

Published 27 November 2026 · 11 min read

A Telegram bot never reads your chat directly. Telegram packs every message into a small parcel called an update and hands it to the bot's program, and the program decides what to do with it. Below is the whole path in plain words: what the Bot API is, what a bot actually receives when you send text, a photo or a forwarded message, how webhook and polling differ, what rules Telegram sets for every bot, and where an AI agent sits in this chain.

“Every message is a parcel”: a young woman in a teal coat stands at a small wooden post counter floating above a sea of pink clouds at dawn, glowing envelopes fly toward her in one long line, and she catches the next one

The short answer

The Telegram Bot API is the doorway between Telegram and a bot's program. A bot in Telegram is a special account without a phone number. On its own it does nothing: every message you send to it is packed by Telegram into an update, a short structured note that says who wrote, in which chat, when, and what exactly (text, photo, voice, file, button). The bot's program picks up these updates, decides what to do and sends the answer back through the same doorway.

So “how does a bot receive messages” has a simple answer: Telegram keeps the update on its servers, and the program collects it, either by getting it delivered to a web address (a webhook) or by asking for news itself (polling). Everything a bot can and cannot see follows from that chain: it gets what is sent to it, and in groups what its rights and privacy mode allow; files arrive as references it downloads, and groups have their own rules.

In WAM Agents the chain is the same, only the program at the end is an AI agent: your bot sits on your Telegram account, the program behind it runs in your agent's own container, and the model reads the update the way you would read a letter.

What the Bot API is, without the jargon

Picture a big post office. Telegram is the post office: it holds every chat, encrypts the traffic and knows where everyone is. A bot is a mailbox with a name, like @candle_shop_bot, that people can write to. The owner of the mailbox has a program somewhere on a server. The Bot API is the counter where that program comes to collect the mail and drop off the replies.

Telegram's own description says the same in technical words: bots are special accounts that do not need a phone number, they are connected to their owner's server, and Telegram's intermediary server handles all encryption and communication. The program talks to that server through a simple web interface, and that interface is called the Bot API.

The rules of the counter are published in the Bot API documentation: which requests the program can make (send a message, send a photo, download a file, set a webhook), what the answers look like, and what a bot is allowed to see. The interface keeps growing: in November 2026 Telegram released Bot API 10.4. The basic path of a message has stayed the same for years.

The path of one message, stop by stop

Here is what happens between the moment you press Send and the moment a reply appears. It takes a second or two, but there are five separate stops.

The path of one message: you write in Telegram, Telegram stores it as an update, the bot's program picks it up, the AI agent reads it and does the work, the reply travels back the same way
From your message to the agent and back: five stops
  1. You write. Text, a voice note, a photo, a PDF or a forwarded message, in a private chat with the bot or in a group where it is a member.
  2. Telegram makes an update. Its servers store the message and wrap it into an update with a number, the chat, the sender, the time and the content.
  3. The program picks it up. By webhook or by polling, more on that below. Until it is collected, Telegram keeps the update for up to 24 hours.
  4. The program does the work. A simple bot matches a command to a ready answer. An AI agent passes the content to a model, which may search, read a file, check its memory or run a tool.
  5. The reply goes back. The program asks the Bot API to send a message, and Telegram delivers it to your chat like any other message.

Nothing in this chain lets a bot reach into your phone or your other chats. It only ever holds the updates that Telegram handed to it.

What a bot actually receives: the update

An update is not a screenshot of your chat. It is a structured record, and it helps to know what is in it.

  • Who and where. The sender's name and username, the chat (private, group, a topic inside a forum group) and the time.
  • The content. The text with its formatting, or a description of the media: photo, voice, video, document, sticker, location, contact, poll.
  • Context. Which message you replied to, and for forwarded messages, a field about the original: who or which channel it came from. If the original author hid their account in privacy settings, the bot sees only the name, the same as you do.
  • Buttons. When you press a button under a bot's message, that press comes as its own update too.

Files are the interesting part. A photo or a PDF does not travel inside the update. The update carries a file identifier, and the program then asks Telegram for the file itself. Through the standard path a bot downloads files up to 20 MB and sends files up to 50 MB. A bot that runs its own local Bot API server lifts the download limit and can send up to 2,000 MB.

For your agent in WAM Agents this means: files up to 20 MB arrive through the standard Bot API path for every agent; larger files come in where large-file receiving is switched on for the agent's server. A voice note is a file as well, and the agent turns it into text before reading. A photo goes to the model's vision.

Webhook or polling: two ways to collect the mail

The program has two ways to collect updates, and Telegram's documentation calls them mutually exclusive: a bot uses one or the other.

Webhook is home delivery. The program gives Telegram a public web address, and Telegram sends every new update there the moment it appears. It is fast and suits big bots, but the program needs a public address with a certificate and an open port.

Polling (long polling, to be exact) is checking the mailbox. The program calls the getUpdates method and waits. If there is news, Telegram answers at once; if not, it holds the line for a while and then answers “nothing yet”, and the program asks again. No public address is needed, only an outgoing connection to the internet.

For you as the person writing to a bot, the difference is invisible: both ways bring the same updates, in the same order, a second or two after you send. In either case Telegram stores updates until they are collected, for up to 24 hours. If a bot's program restarts for a minute, your message waits for it on Telegram's side.

The choice matters to whoever runs the program. Polling is why a small bot can live on any machine with internet access, including the container of an AI agent. The article Host a Telegram bot 24/7: your AI agent runs a bot, a scraper or a job in its own container shows that in practice.

Three rules Telegram sets for every bot

Some things look like a bot's choice but are really Telegram's rules for all bots. They explain most of the “why can't it…” questions.

A bot speaks second. A bot cannot start a conversation. You write to it first or add it to a group, and only then can it answer. That is why every bot, your agent included, starts with a Start button.

A bot sees the group from the moment it was added. Telegram does not give bots the history of a group from before they were added. Whatever was said earlier stays out of reach, even for an admin bot.

In groups, privacy mode decides. By default a bot in a group receives only commands, replies to its own messages and messages that mention it. A bot that is an admin, or has privacy mode switched off, receives all messages of the group. Messages from other bots never reach it. The full picture of how this works for an AI agent, with mention mode and guest access, is in What an AI bot sees in a Telegram group: mention mode, admin rights and other people's messages.

There are speed limits too: according to the Bot FAQ, a bot sends no more than 20 messages a minute in one group and about 30 messages a second across all its chats. For a personal assistant these limits are far away.

Where the bot token fits in

Every request the program makes to the Bot API carries the bot's token, a long secret string that BotFather gives to the bot's owner. The token is the key to the counter at the post office: whoever holds it can collect the bot's mail and send messages in its name. That is why the token is kept private and revoked at once if it leaks.

In WAM Agents you never handle the token yourself. Your bot is created through Telegram's official Managed Bots mechanism right on your account, so you own it from the first minute. The service receives the token through that mechanism and does not write it to logs. If you ever revoke the token in BotFather, the /mybot command in @wamagentsbot connects your agent to the new one. Step by step, with what to do if a token leaks, in Your own Telegram bot: who owns it, what a bot token is, and how to revoke it in BotFather.

How an AI agent sits on this chain

Up to stop four, a simple bot and an AI agent are the same: an update arrives, the program picks it up. The difference is what happens next.

A classic bot works like a vending machine. It recognises commands and buttons from a list prepared by its developer and returns prepared answers. Anything outside the list gets “I don't understand”.

An AI agent passes the update to a language model with tools around it. It reads your message in plain words, sees the photo, turns the voice note into text, opens the PDF, remembers what you told it last week and decides which tool fits: web search, a file, a reminder, your Gmail after you connect Google. Then it writes the reply and sends it through the same Bot API.

On WAM Agents the program behind your bot runs inside your agent's own isolated container. That is also where the group filter works: when the agent is in mention mode, a message not addressed to it is dropped inside the container by the bot's program before it reaches the model, and it gets into neither the history nor the agent's memory. Messages that did reach the agent stay in its journal in the same container, so it can return to a topic or find a file you sent weeks ago. The agent starts in Telegram, and other messengers can be connected.

If you want the terms around all this in one place (update, privacy mode, admin rights, topics, MCP), there is AI agent in Telegram: 18 terms in plain English. And if you want a bot for a specific job without writing code, read How to create a Telegram bot without code: an AI agent instead of a bot builder, set up in six messages.

Four things worth knowing when you write to a bot

Send the file, not a screenshot of it. A PDF or a spreadsheet arrives as a real file the agent can open and quote. A screenshot of the same table becomes a photo it has to read by eye.

Forward with context. When you forward a customer's message, add one line about what you want: “reply politely and offer Thursday”. The update brings the original author and text, your line brings the task.

In a group, make the agent an admin if it needs to follow the whole chat. Without admin rights and with privacy mode on, Telegram delivers only commands, replies to the bot and mentions. Mention mode then decides which of the delivered messages the agent answers.

Large files: 20 MB is the standard line. For anything heavier, a link to the file in your Drive often works better than an attachment, especially after you connect Google.

What it costs

Receiving a message costs nothing: Telegram delivers updates for free, and magnets are spent only when the agent does something. A reply in an ongoing conversation costs a fraction of a magnet on the default DeepSeek Flash; the first reply of a new session, or after /clear, costs 3–4 M because the agent reads its whole setup. Transcribing a voice note costs 1 M a minute, reading a photo or a screenshot 1.5 M, a web search 1.5 M. Free gives you 200 M in the first month and 100 M every month after that, no card. Pro is $13.90 a month with 400 M, and $1.39 for the first month if you subscribe within your first 7 days. All rates are on the Pricing page.

Read next

Messages worth copying

Explain in five short lines what happens between the moment I press Send and the moment your reply appears.

I'm forwarding you a message from a customer. Tell me who wrote it and draft a polite reply offering Thursday.

Here is a PDF. Read it and give me the three numbers that matter, with the page for each.

I'm adding you to my team's group. What rights do you need there, and which messages will you answer?

Open your agent in Telegram, send it a voice note and a file in one go, and ask what exactly arrived. Start with your own agent.

Try it with your own agent

Free, no card. The agent starts working in the chat straight away.

Create your AI agent

Questions

What is the Telegram Bot API in one sentence?

It is the set of rules through which a bot's program talks to Telegram: the program receives updates (new messages, button presses, new members) and sends back replies, photos and files. The bot itself is a special Telegram account without a phone number; the brain behind it is the program on its owner's server.

Does a bot read all my chats?

No. A bot receives only what is sent to it: messages in a private chat with it, and in groups either everything (if it is an admin or privacy mode is off) or only commands, replies to its messages and messages that mention it. It never sees your other chats, and it cannot read a group's history from before it was added.

What is the difference between webhook and polling?

They are two ways for the program to pick up updates. With a webhook, Telegram delivers each update to the program's public web address the moment it arrives. With polling, the program asks Telegram “anything new?” and waits for an answer. Both give the same updates; Telegram keeps undelivered ones for up to 24 hours.

How big a file can a bot receive?

Through the standard Bot API a bot downloads files up to 20 MB and sends files up to 50 MB. A bot that runs its own local Bot API server lifts the download limit and sends up to 2,000 MB. Your agent in WAM Agents takes files up to 20 MB through the standard path, and larger ones where large-file receiving is switched on for its server.

Can a bot write to me first?

No. Telegram lets a bot start a conversation only after you write to it or add it to a group. That is why every bot, including your agent, begins with you pressing Start. After that it can reply, send reminders and report results in the same chat.

Do I need to know the Bot API to use an AI agent in Telegram?

No. In WAM Agents the bot is created on your account in one tap, the program behind it already runs in your agent's container, and you just write in plain words. Knowing the path is useful for one thing: understanding what the agent can see, what it keeps and why files and groups work the way they do.

Your AI agent in Telegram, ready in a minute

Open the bot, hit Start, and it walks you through the rest.

Create your AI agent

Free · no card · nothing to install · cancel in the bot

Free no card, nothing to set upCreate your AI agent