bots.createBot #

Create a managed bot » owned by the current user and controlled by the specified manager bot.

Layer 223

Method schema is available as of layer 224. Switch »

Parameters #

NameTypeDescription
flags#Flags, see TL conditional fields
via_deeplinkflags.0?trueSet only if the creation prompt was opened from a managed bot creation request deep link »
namestringDisplay name of the bot, 1–64 characters
usernamestringUsername for the bot, as validated by bots.checkUsername
manager_idInputUserThe manager bot that will control the created bot; must have the user.bot_can_manage_bots flag set

Result #

User

Only users can use this method #

Possible errors #

CodeTypeDescription
400BOT_CREATE_LIMIT_EXCEEDEDThe current user already owns the maximum allowed number of owned bots, as specified by bots_create_limit_default » and bots_create_limit_premium »; if the current user doesn't have Telegram Premium, upgrading to Premium will allow them to create more bots.
400MANAGER_INVALIDThe specified manager bot is invalid.
400MANAGER_PERMISSION_MISSINGThe specified manager bot does not have the user.bot_can_manage_bots flag set.
400NAME_INVALIDThe specified bot name is invalid.
400USERNAME_INVALIDThe provided username is not valid.
400USERNAME_OCCUPIEDThe provided username is already occupied.
400USERNAME_SUFFIX_MISSINGThe required bot suffix is missing from the passed username.

Telegram clients must handle special tg:// and t.me deep links encountered in messages, link entities and in other apps by registering OS handlers.

bots.checkUsername #

Check whether a username is available and valid for use when creating a managed bot ».

user #

Indicates info about a certain user.

Unless specified otherwise, when updating the local peer database, all fields from the newly received constructor take priority over the old constructor cached locally (including by removing fields that aren't set in the new constructor).

See here » for an implementation of the logic to use when updating the local user peer database.

Managed bots #

Users can create managed bots (which are controlled by a specific manager bot) directly through the MTProto API, without interacting with @BotFather.

Client configuration #

The MTProto API has multiple configuration parameters that can be fetched with the appropriate methods.