telegram-bot
Skill0 starsChanged 36 days agoMITView on GitHub
Build, host and automate Telegram bots in TypeScript (grammY) or Python (aiogram, python-telegram-bot) — BotFather setup, webhooks vs long polling, commands, deep links, keyboards, groups and channels, broadcasts and rate limits, AI bots that stream replies, Business bots, managed bots, guest mode, ephemeral messages and launching a Mini App. Use this skill whenever the user creates or edits a Telegram bot, asks about BotFather, a bot token, webhooks, getUpdates, bot commands, start parameters, mass messaging, posting to a channel on a schedule, a support or AI chat bot, or hosting a bot on Vercel, a VPS or another serverless platform.
- Reads credentials
8 other projects use a version of this.
Adopted by
Most recently taken up by
- oivanfelipe/claude-skillstheir own version, first seen Nov 8, 2026
- ScriptingApp/skillstheir own version, first seen Oct 28, 2026
- AceDataCloud/Skillstheir own version, first seen Oct 6, 2026
- DEXTERITY-maker/rikkahub-skillstheir own version, first seen Jul 15, 2026
- OpenClaudia/openclaudia-skillstheir own version, first seen Jun 11, 2026
- leo-capvano/telegram-skilltheir own version, first seen Apr 30, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- OpenClaudia/openclaudia-skills★ 731same name
- claude-office-skills/skills★ 433same name
- AceDataCloud/Skills★ 17same name
- ScriptingApp/skills★ 16same name
- grandamenium/openclawd-lesson-1-telegram-bot★ 4same name
- DEXTERITY-maker/rikkahub-skills★ 1same name
- leo-capvano/telegram-skill★ 1same name
- oivanfelipe/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository11 other files it gives its agents.
- add-paymentsSkill
- add-ton-connectSkill
- audit-projectSkill
- deploy-testnetSkill
- new-botSkill
- new-mini-appSkill
- telegram-devSkill
- telegram-launchSkill
- telegram-mini-appSkill
- telegram-paymentsSkill
- telegram-tonSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Use what the project already has.
- Very specific: line 94
Posting to a channel: add the bot as an admin with post rights.
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Telegram bot
The Bot API changes every month or two (10.3 in August 2026). Before using any method or field
you are not sure about, check https://core.telegram.org/bots/api-changelog. Frameworks lag behind
the API; when a framework has no wrapper yet, call the method through the framework's raw
API (bot.api.raw.<method> in grammY, a custom TelegramMethod in aiogram) instead of inventing
a wrapper that doesn't exist.
Stack
| Language | Default | Notes |
| TypeScript | grammY | Node, Deno, Bun, edge; webhook adapters for most hosts |
| Python | aiogram 3 | async, routers, FSM; python-telegram-bot if the project already uses it |
Use what the project already has. Look up current setup in the framework docs rather than writing boilerplate from memory.
Setup
@BotFather→/newbot. The token goes into a backend env var (BOT_TOKEN), never into the repo, the Mini App bundle or a chat message. A leaked token is revoked in @BotFather.- Commands via
setMyCommands: 1-32 characters, only lowercase English letters, digits and underscores (/Startor/my-cmdare rejected). Scope them per chat type and language if needed. - Mini App entry points: menu button, an inline button with
web_app, a direct linkhttps://t.me/<bot>/<app>?startapp=<param>or the main Mini Apphttps://t.me/<bot>?startapp.
Webhook or long polling
- Local development: long polling. Production and serverless: webhook over HTTPS on port 443, 80, 88 or 8443.
setWebhookwith asecret_token(1-256 chars ofA-Za-z0-9_-); reject every request whoseX-Telegram-Bot-Api-Secret-Tokenheader doesn't match. Setallowed_updatesto what the bot handles; addpre_checkout_queryfor payments and anything new you rely on, because some update types are not delivered unless listed.- Acknowledge fast. On serverless, do slow work after replying or in a queue; Telegram retries when the webhook times out, which produces duplicates.
- Make handlers idempotent: key on
update_idor on the business object (order id, charge id). getUpdatesdoesn't work while a webhook is set. It returns the earliest 100 unconfirmed updates; confirm withoffset = last update_id + 1.
Deep links and state
https://t.me/<bot>?start=<value>: up to 64 chars of A-Za-z0-9_-. Pass an opaque id and keep
state on the server; never put secrets or raw user ids in it. In Mini Apps the equivalent is
startapp, which arrives as start_param.
Limits
Source: https://core.telegram.org/bots/faq (Telegram says the values may change).
- One chat: about 1 message per second (short bursts, then 429). A group: 20 per minute. Bulk: about 30 messages per second overall.
- Paid broadcasts (
allow_paid_broadcast) go up to 1000 per second at 0.1 Stars per message above the free 30, from the bot's Stars balance. The FAQ and the API reference give different minimum balances; read the current text before promising numbers. - On 429, wait
retry_after. For broadcasts use a queue plus grammYauto-retry/ throttler, or an aiogram middleware with backoff. Mark users who blocked the bot (403) and stop sending. - A bot can't start a conversation. The user must message it first or add it to a group.
Changes that older answers get wrong
- Bots and other bots. Since Bot API 10.0 bots can see certain messages from other bots in
groups, and bots can message each other by username when both enabled bot-to-bot
communication. Don't assume bot messages are invisible; filter
from.is_botif you must ignore them. Group bots still default to privacy mode. - Streaming AI replies.
sendMessageDraft(all bots since 9.5) shows a draft that lives about 30 seconds. Stream into it with the same non-zerodraft_id, then send the final text withsendMessage, or the answer disappears. Empty text shows "Thinking…";can_stoplets the user stop generation and you receivestopped_message_generation. Rich formatting:sendRichMessage/sendRichMessageDraft(10.1). - Ephemeral messages (visible to one user in a group): introduced in 10.2 with
receiver_user_idandcallback_query_id; in 10.3 these were replaced byephemeral_message_parameters. Use the 10.3 shape. - Polls.
correct_option_idbecamecorrect_option_ids(9.6); quizzes may now have several correct answers and acceptallows_multiple_answers. Options areInputPollOptionobjects. - Guest mode (10.0): a bot can answer in chats it isn't a member of via
guest_messageupdates andanswerGuestQuery. - Managed bots (9.6): a manager bot can create bots for users
(
https://t.me/newbot/<manager>/<suggested_username>), receivemanaged_botupdates and fetch or rotate their tokens withgetManagedBotToken/replaceManagedBotToken. Treat those tokens like your own: encrypted at rest, never logged. - Business bots (9.0+, no Premium needed since 10.0): act for a business account through
business_connection_id; checkBusinessBotRightsbefore each action instead of assuming. - Paid subscriptions now produce
subscriptionupdates (BotSubscriptionUpdated, 10.2).
Automation
- Posting to a channel: add the bot as an admin with post rights; send to
@channelnameor the numeric id. Schedule with a cron on your side (Vercel Cron, a worker, APScheduler); the Bot API has no scheduled sending. - Suggested and paid posts (9.2): paid posts must not be deleted for 24 hours or the payment is lost.
- Userbots (MTProto via Telethon, Pyrogram, GramJS) act as a real account. They break no Bot API rules but are easy to get banned for spam, need the user's phone login and session string (a full account credential). Prefer a bot; if the user insists, warn them and keep the session out of the repo.
Payments and wallets
Stars and digital goods: telegram-payments. TON, wallets, jettons: telegram-ton. Never
fulfil an order from a client-side callback. To bind a bot user to a wallet, validate initData
in the Mini App and verify ton_proof; never trust a bare address.
Before launch
- Token only in env;
.envgit-ignored;.env.examplehas placeholders. - Webhook secret verified;
allowed_updatesset; handlers idempotent. - Errors go to a log, not verbatim to users;
/starthandles missing and unknown params. - Tested in a private chat, a group, and with a user who blocked the bot.
- Broadcasts throttled and resumable. See
telegram-launchfor the full checklist.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

