Bots

Working with bots, using the MTProto API.

See here for more info about bots.

Please note that you can also use the simplified HTTP Bot API to use bots, see here for more info ».

Login

---functions---

auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization;

In order to login as a bot, instead of using the standard login code flow, simply provide the bot token generated by @botfather.
You must still provide your API ID, as per user logins.

After successful authorization, you will be able to use most MTProto API methods, just as any normal user.
Methods that can be called by bots will have a Bots can use this method notice.

Edit bot information »

Users can edit and localize the profile picture, name, about text and description of bots they own; the same can be done by the bots themselves.

Commands »

Bots offer a set of commands that can be used by users in private, or in a chat.

Buttons »

Users can interact with your bot via buttons or even inline buttons, straight from inline messages in any chat.

Menu button »

Bots can choose the behavior of the menu button shown next to the text input field.

Suggested bot admin rights »

Bots can suggest a set of admin rights when being added to groups and channels.

Inline queries »

Users can interact with your bot via inline queries, straight from the text input field in any chat.

Games »

Bots can offer users HTML5 games to play solo or to compete against each other in groups and one-on-one chats; how to work with games in the MTProto API.

Web apps »

Bots can offer users interactive HTML5 web apps to completely replace any website.

Attachment menu »

Bots can install attachment menu entries, offering conveniently accessible, versatile web apps.

Business bots »

Business users can connect Telegram bots that will process and answer messages on their behalf. This allows businesses to seamlessly integrate any existing tools and workflows, or add AI assistants that manage their chats.

Bot API dialog IDs

How to convert MTProto peer IDs to bot API dialog IDs and vice versa.