How to retrieve bot command list from Telegram bot programmatically

I’m working on a Telegram bot and need to fetch the command list that I set up through BotFather. I want to get these commands in my application so I can validate what users are typing.

I’ve been looking through the Telegram Bot API documentation but can’t seem to find a method that returns the bot’s command list. I also tried checking different libraries but no luck there either.

Basically, I set up commands like /start, /help, /settings using BotFather, and now I need my program to know what these commands are. Is there a way to do this through the API or am I missing something?

Any help would be great, thanks!

You can also hit the getMyCommands endpoint with a POST request instead of GET - sometimes works better depending on your HTTP client. Same endpoint: https://api.telegram.org/bot<TOKEN>/getMyCommands. A lot of developers miss this one since it’s not featured as much in tutorials compared to sendMessage and other common methods. The JSON response gives you commands without the slash prefix, so add it back if you’re doing string matching. This method also respects the scope parameter if you’ve set different commands for different chat types or users, but most basic bots don’t need that.