Two ways to set Telegram bot commands
You set a Telegram bot's command list either in @BotFather with /setcommands, sending one command - description pair per line, or from code with the Bot API method setMyCommands. Each command is 1-32 characters of lowercase English letters, digits and underscores, each description is 1-256 characters, and one list holds at most 100 commands.
Last verified: November 2026 against the Bot API reference (through Bot API 10.3) and Telegram's bot features guide.
The registered list is what Telegram apps show when a user types / and what the menu button next to the message field opens. It does not create any behavior by itself: your code still has to handle /help when it arrives. Registering commands is about discoverability, and a bot with no registered commands leaves users guessing.
| BotFather /setcommands | setMyCommands API | |
|---|---|---|
| Best for | A single static list, set once by hand | Lists in code, per audience, per language, in CI |
| Scopes (private, groups, admins, one chat) | No, sets the default list | Yes, seven scope types |
| Per-language lists | No | Yes, via language_code |
| Ephemeral flag | No | Yes, is_ephemeral on each command |
| Reversible | Re-run with a new list | deleteMyCommands per scope and language |
BotFather /setcommands: the exact format
- Open @BotFather and send
/setcommands(or go through/mybots, pick the bot, then Edit Bot and Edit Commands). - Choose the bot from the list.
- Send the whole list as one message, one command per line, command first, then a space, a hyphen, a space and the description.
start - Start the bot and see what it can do
help - How to use this bot
order - Check the status of an order
support - Talk to a person
settings - Language and notification settings
cancel - Cancel the current actionWrite the command names without the leading slash, the way Telegram's own tutorial does. Sending /setcommands again replaces the whole list rather than appending to it, so always paste the complete set. The list you set here is the default list, equivalent to setMyCommands with the default scope and no language.
If a line is rejected, the cause is almost always the name: a capital letter, a hyphen, a space or a non-Latin character in the command itself. Descriptions are free text and can be written in any language.
Command naming rules and limits
The limits below come from the BotCommand object and setMyCommands in the Bot API reference. They apply to commands you register; Telegram's features guide notes that commands users type can contain Latin letters, numbers and underscores, but only lowercase names are accepted in the registered list.
| Field | Rule |
|---|---|
command | 1-32 characters; lowercase English letters, digits and underscores only; no leading / in the API object |
description | 1-256 characters |
is_ephemeral | Optional boolean; marks a command whose message only the sender and the bot can see |
| Commands per list | At most 100 per setMyCommands call (one scope plus language combination) |
language_code | Two-letter ISO 639-1 code, or empty for the fallback list |
Telegram's guidance is to make commands specific: /newlocation and /newrule rather than a generic /new that then asks a follow-up question. Specific commands are self-documenting in the menu and remove a conversational round trip. Keep names short enough to type on a phone; 32 characters is a ceiling, not a target.
Telegram asks every bot to support three global commands, and its apps add interface shortcuts for them:
/startbegins the interaction and carries deep-link parameters./helpexplains what the bot does and lists its commands./settings, if applicable, shows the user's settings and how to change them.
setMyCommands: setting commands from code
setMyCommands takes a JSON array of BotCommand objects plus optional scope and language_code. It returns true on success. Sending JSON in the body is cleaner than the URL query string because the list nests:
curl -s https://api.telegram.org/bot<TOKEN>/setMyCommands \
-H "Content-Type: application/json" \
-d '{
"commands": [
{"command": "start", "description": "Start the bot"},
{"command": "help", "description": "How to use this bot"},
{"command": "order", "description": "Check an order"},
{"command": "support", "description": "Talk to a person"}
]
}'Run it at deploy time, not on every process start. The list is stored by Telegram per bot, so calling it from each of twenty workers on boot does nothing useful and burns requests. A small script in your release pipeline that sets every scope and language you support keeps the menu in version control alongside the handlers it describes.
The rest of the family:
| Method | What it does |
|---|---|
getMyCommands | Returns the list for a given scope and language as an array of BotCommand; an empty array if none is set |
deleteMyCommands | Deletes the list for a given scope and language; affected users then see the next, broader list |
setChatMenuButton | Changes what the menu button does, per private chat or as the bot default |
getChatMenuButton | Returns the current menu button for a private chat or the default |
Remember that deleteMyCommands with no arguments only deletes the default list. If you set lists for groups, admins or specific languages, each needs its own delete call with the same scope and language_code.
BotCommandScope: different menus for different users
Scopes let one bot show a short menu to customers in private chats, a moderation menu to group admins, and a different list in one specific group. The API defines exactly seven scope types:
| Scope object | type value | Extra fields | Covers |
|---|---|---|---|
| BotCommandScopeDefault | default | None | Everyone, when no narrower list applies |
| BotCommandScopeAllPrivateChats | all_private_chats | None | All one-to-one chats with the bot |
| BotCommandScopeAllGroupChats | all_group_chats | None | All groups and supergroups |
| BotCommandScopeAllChatAdministrators | all_chat_administrators | None | Administrators of all groups and supergroups |
| BotCommandScopeChat | chat | chat_id | One specific chat |
| BotCommandScopeChatAdministrators | chat_administrators | chat_id | Administrators of one group or supergroup |
| BotCommandScopeChatMember | chat_member | chat_id, user_id | One member of one group or supergroup |
chat_id accepts a numeric ID or a supergroup @username; the reference notes that channel chats and channel direct-message chats are not supported for the chat-based scopes. A moderation menu for admins everywhere looks like this:
curl -s https://api.telegram.org/bot<TOKEN>/setMyCommands \
-H "Content-Type: application/json" \
-d '{
"scope": {"type": "all_chat_administrators"},
"commands": [
{"command": "warn", "description": "Warn the replied-to user"},
{"command": "mute", "description": "Mute the replied-to user"},
{"command": "stats", "description": "Group activity summary"}
]
}'Which list a user actually sees
Telegram resolves the menu by walking a fixed order and returning the first list that is set. Lists do not merge: if an admin list exists, admins see only that list, not the admin list plus the group list. Repeat shared commands such as /help in every list.
| In a private chat with the bot | In a group or supergroup |
|---|---|
1. chat + language | 1. chat_member + language |
2. chat | 2. chat_member |
3. all_private_chats + language | 3. chat_administrators + language (admins only) |
4. all_private_chats | 4. chat_administrators (admins only) |
5. default + language | 5. chat + language |
6. default | 6. chat |
7. all_chat_administrators + language (admins only) | |
8. all_chat_administrators (admins only) | |
9. all_group_chats + language | |
10. all_group_chats | |
11. default + language | |
12. default |
Scopes control what is shown, not what is allowed. The features guide is explicit that updates carry no information about the scope a command came from, and may contain commands that do not exist in your bot at all. Anyone can type /mute. Check the sender's rights in your handler, for example with getChatMember, before acting on a privileged command.
Handling commands in code: python-telegram-bot, aiogram, grammY and Telegraf
Registering a command makes it visible; a handler makes it do something. Each major library has a command router, and each makes slightly different choices about arguments, @botname suffixes and edited messages. Those differences explain a surprising share of "my command handler misbehaves" reports.
# python-telegram-bot (v20+)
from telegram.ext import Application, CommandHandler, filters
async def order(update, context):
if not context.args: # "/order 8812" -> ["8812"]
await update.message.reply_text("Usage: /order <number>")
return
await update.message.reply_text(f"Looking up order {context.args[0]}")
app.add_handler(CommandHandler(
"order", order,
filters=~filters.UpdateType.EDITED_MESSAGE)) # see below
# aiogram 3
from aiogram.filters import Command, CommandObject
@router.message(Command("order"))
async def order(message, command: CommandObject):
await message.answer(f"Looking up order {command.args}") # None if no args
// grammY
bot.command("order", (ctx) => ctx.reply(`Looking up order ${ctx.match}`));
// Telegraf
bot.command("order", (ctx) => ctx.reply(`Looking up order ${ctx.payload}`));
| Library | Arguments arrive as | /cmd@other_bot | Edited messages |
|---|---|---|---|
python-telegram-bot CommandHandler | context.args, a list split on whitespace | Ignored | Handled by default; exclude with ~filters.UpdateType.EDITED_MESSAGE |
aiogram Command filter | command.args, the raw string or None | Ignored unless ignore_mention=True | Only if you register the handler on edited messages |
grammY bot.command() | ctx.match, the string after the command | Ignored; /cmd and /cmd@your_bot both match | Not by default |
Telegraf bot.command() | ctx.payload (string) or ctx.args (array) | Ignored; the username comparison is case-insensitive | Not by default |
The edited-message default in python-telegram-bot is the one that bites. Its documentation says CommandHandler "listens to messages as well as edited messages", so a user who fixes a typo in /refund 8812 triggers the handler a second time. For read-only commands that is harmless; for anything that places an order, sends a message to a third party or changes state, add the filter shown above. The same documentation notes that CommandHandler does not handle channel posts or commands in media captions; those need a MessageHandler with suitable filters.
All four routers only treat a command at the very start of the message as a command. grammY's guide spells it out: in "Please do not send /start to that bot!" the /start handler is not called. aiogram's Command filter also accepts ignore_case=True if you want /Order to match, which matters because users can type capital letters even though registered command names must be lowercase.
Parsing commands without a library: use the bot_command entity
If you are writing against the raw Bot API, do not detect commands with text.startsWith("/"). Telegram already parsed the message for you: every command in a message comes with a MessageEntity of type bot_command, with an offset and length measured in UTF-16 code units. A command at the start of the message has offset 0.
function parseCommand(message, botUsername) {
const e = message.entities?.[0];
if (!e || e.type !== "bot_command" || e.offset !== 0) return null;
// offset/length are UTF-16 code units, which is how JS strings index too
const raw = message.text.slice(0, e.length); // "/order@acme_bot"
const [cmd, target] = raw.slice(1).split("@");
if (target && target.toLowerCase() !== botUsername.toLowerCase()) return null;
return { command: cmd.toLowerCase(), args: message.text.slice(e.length).trim() };
}
The UTF-16 detail matters outside JavaScript. In Python, len() and slicing count code points, so an emoji before an entity shifts every offset after it; Telegram's offsets only line up with Python string indexes when the text has no characters outside the Basic Multilingual Plane. For a command at offset 0 this is rarely an issue, but the same parser reused for links or mentions later in the message will be off by one per emoji unless you encode to UTF-16 first. Treat the argument string as untrusted user input, exactly as with a deep-link payload: validate it, length-limit it, and never pass it straight into a database query or shell command.
Localized command lists with language_code
Pass language_code with a two-letter ISO 639-1 code and the list applies only to users whose Telegram app language matches. Leave it empty and the list becomes the fallback for that scope, used for every language you have not covered. A sensible setup is an English (or primary-market) list with no language_code, plus one call per translated language:
{
"language_code": "es",
"commands": [
{"command": "start", "description": "Iniciar el bot"},
{"command": "help", "description": "Cómo usar este bot"},
{"command": "order", "description": "Consultar un pedido"}
]
}Translate descriptions, not command names. Command names are restricted to lowercase English letters, digits and underscores in every language, and keeping /order identical everywhere means one handler, consistent support documentation, and links that work for everyone. The same applies per scope: language-specific lists sit above the plain list at every level of the resolution order shown above.
Commands, reply keyboards, inline keyboards or a Mini App?
Commands are one of four ways a Telegram bot can offer choices, and the features guide treats them as complementary. Picking the right one for each interaction is most of good bot design:
| Interface | What the user does | What your bot receives | Best for |
|---|---|---|---|
| Commands | Types / or opens the menu and picks one | A message with a bot_command entity | Entry points and power-user shortcuts: /start, /help, /order |
Reply keyboard (ReplyKeyboardMarkup) | Taps a button that replaces the phone keyboard | A plain text message with the button label, or a shared contact, location or chat | Short multiple-choice answers inside a flow; one_time_keyboard hides it after use |
Inline keyboard (InlineKeyboardMarkup) | Taps a button under one of the bot's messages | A callback_query (no message is sent to the chat) | Menus, pagination, settings toggles, confirmations |
| Mini App | Opens a web interface inside Telegram | Data from the web app | Catalogs, forms and checkout flows too rich for buttons |
A practical split for most business bots: a handful of commands as stable entry points, inline keyboards for every choice after that, and reply keyboards only when the answer should appear in the chat history (a shared phone number, a yes or no the user will want to scroll back to). Telegram recommends editing an inline keyboard in place when the user toggles a setting or changes page, rather than sending a new message each time.
Inline buttons come with their own limits and errors: callback_data is 1-64 bytes, a callback query must be answered with answerCallbackQuery or the user sees a spinner, and answering too late returns query is too old. Oversized payloads fail with BUTTON_DATA_INVALID, and editing a keyboard to an identical one returns message is not modified. The keyboard builder checks the byte limits as you lay buttons out, and the text formatter produces the escaped text that goes above them.
/start with a payload: deep links
Every bot has a link, https://t.me/<bot_username>, and you can append a parameter that reaches your bot as part of /start:
| Link | What your bot receives |
|---|---|
https://t.me/your_bot?start=airplane | /start airplane in the private chat |
https://t.me/your_bot?startgroup=spaceship | The user picks a group to add the bot to; the update text is /start@your_bot spaceship |
Per Telegram's deep linking documentation, the parameter allows A-Z, a-z, 0-9, _ and -, up to 64 characters. Telegram recommends base64url for anything binary. Common uses are campaign attribution (?start=ig_bio), linking a Telegram account to a web account with a one-time code, and landing a user directly in a flow (?start=order_8812).
Parse it defensively. Your /start handler should split on the first space, treat the remainder as untrusted input, and still work when the payload is missing, because users also start bots by tapping Start with no link involved. For account linking, use a short-lived random code that maps to the account server-side rather than putting a user ID or email in the link. The Telegram link generator builds and validates both link types.
Commands in groups: @botname and privacy mode
In a group with several bots, /help is ambiguous. Telegram's convention is the suffixed form /help@your_bot, which the docs list as a command "explicitly meant" for that bot. Your parser should accept both forms and should ignore commands addressed to a different bot.
/order 8812 -> command "order", args "8812"
/order@your_bot 8812 -> same, explicitly addressed to you
/order@other_bot 8812 -> not for you, ignorePrivacy mode decides which of those messages reach you at all. It is on by default, and a bot in privacy mode receives, per the docs:
- commands explicitly meant for it, such as
/command@this_bot; - general commands such as
/start, if this bot was the last bot to send a message to the group; - inline messages sent via the bot, and replies to messages meant for it;
- plus, regardless of privacy mode, all service messages.
So a bare /help in a busy group with other bots may never arrive. Bots added as administrators receive all messages. Disabling privacy mode with BotFather's /setprivacy also works, but the change only takes effect after the bot is removed and re-added to the group, a step that accounts for many "it works in DMs but not in my group" reports covered in why a Telegram bot is not responding.
Ephemeral commands
Bot API 10.2 (July 2026) added an optional is_ephemeral field to BotCommand. When a command is declared ephemeral, the user's message invoking it is delivered to your bot but stays invisible to other group members and other bots, so someone can run /balance in a public group without broadcasting it. Bots can answer with ephemeral messages visible only to that user. The details and timing rules are in our Bot API 10 breakdown.
Errors command handlers hit, and what each one means
The handler runs, tries to reply, and the Bot API says no. These are the errors that show up most often in command handlers specifically, because commands are where a bot first talks to a new chat:
| Error | Typical command-handler cause | Fix |
|---|---|---|
| 403 bot was blocked by the user | Replying to a user who blocked the bot after sending the command | Catch it, mark the user inactive, stop messaging them |
| 403 bot can't initiate conversation | A group command handler tries to DM a user who never pressed Start | Reply in the group with a ?start= deep link instead |
| 400 chat not found | A stored chat_id from another bot, or a typo | Use the chat.id from the incoming update |
| 400 group chat was upgraded to a supergroup | The group became a supergroup and got a new ID | Read migrate_to_chat_id from the error and update your records |
| 400 can't parse entities | /help text with unescaped Markdown or HTML | Escape the reply or drop parse_mode |
| 400 message is too long | A /list or /help reply over 4,096 characters | Split the reply or paginate with an inline keyboard |
| 429 Too Many Requests | A broadcast command, or many users running a command at once | Wait the retry_after seconds, then queue sends |
The supergroup case catches long-running group bots: the error's parameters object carries migrate_to_chat_id, which the Bot API notes can have more than 32 significant bits, so store chat IDs as 64-bit integers. The rest of the catalogue, with the literal error strings to search your logs for, is in the Telegram error directory and the Bot API error codes guide.
A command setup checklist
- Handle
/start,/helpand, if you have settings,/settings. Make/startwork with and without a payload. - Name commands with lowercase letters, digits and underscores, 32 characters or fewer, and make each one specific.
- Set the default list, then narrower lists only where the audience truly differs. Repeat shared commands in every list, because lists do not merge.
- Add
language_codelists for translated descriptions, keeping command names identical. - Set lists from a deploy script with
setMyCommands, and verify withgetMyCommandsfor each scope. - Enforce permissions in the handler; scopes only hide menu entries.
- Parse
/cmd@your_botand ignore commands addressed to other bots. - Decide whether edited messages should re-run a command, and filter them out where they should not.
- Decide deliberately between the commands menu button and a Mini App button.
Message length, callback data, polling and request ceilings that commands run into are collected on the Telegram limits page, and any error string a command handler hits is explained in the Bot API error codes guide. If you are still at the very first step, how to get a Telegram bot token covers BotFather and token safety, and the token checker confirms the token works before you register a single command.
Where Telegram earns its place as a business channel
A short, well-scoped command menu is often the whole user interface of a business bot on Telegram: /order, /support and /settings do more for a customer than a long welcome message. That shape shows up again and again in the industries where Telegram works as a real channel - ecommerce order tracking and cart recovery, logistics dispatch and driver updates, education announcements and course Q&A, media subscriptions, nonprofit volunteer coordination and technical support for developer audiences.
Deep links do the acquisition work: a ?start= payload on an ad, a QR code on a parcel or a link in an email tells you exactly where each conversation came from, and the link generator builds them. Our guides to Telegram for business and Telegram bots for customer support cover the conversation design behind the menu, and ready-made Telegram templates give you a working starting point.
Avoiding this class of problem entirely
Commands look simple until you own all of it: the registered lists per scope and language, the router, the edited-message and @botname edge cases, permission checks, escaping, rate limits and the webhook underneath. None of that is what makes your bot useful to customers, and every chat platform has its own version of it - Discord has slash commands with their own registration and permission model (see Discord bot not responding), and Slack has its own token types and scopes (see Slack bot token types).
A managed platform handles the transport so you can work on the conversation. With Conferbot's Telegram channel, available on every plan including Free, you connect a bot token and build the flow in a visual editor - webhook registration, retries, rate limiting and message formatting are handled for you, and buttons adapt to each platform automatically. The same flow deploys to WhatsApp, Discord, Slack and a website widget without rewriting it per platform, with every conversation in one omnichannel inbox and live chat handover when a person needs to step in.
Start free with Conferbot - the free plan includes 600 conversations a month and needs no credit card, so you can have the same flow running on a second channel this afternoon.
If you are wiring commands by hand today, start with the checklist above and the scope resolution table - most "missing command" reports are a narrower list shadowing the one you set. If you find yourself building the same router for a third channel, that is the point where a platform starts paying for itself.
Was this article helpful?
Build and deploy in 10 minutes. No coding needed.
Telegram Bot Commands FAQ
Everything you need to know about chatbots for telegram bot commands.
About the Author
The Conferbot team writes about building, deploying, and improving AI chatbots.
View all articlesRelated Articles
From the reference shelf
Fact-checked reference pages and free tools for the platform this article covers.