bots.createBot

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

 Method schema is available as of layer 224. Switch »

Parameters

Name Type Description
flags # Flags, see TL conditional fields
via_deeplink flags.0?true Set only if the creation prompt was opened from a managed bot creation request deep link »
name string Display name of the bot, 1–64 characters
username string Username for the bot, as validated by bots.checkUsername
manager_id InputUser The 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

Code Type Description
400 BOT_CREATE_LIMIT_EXCEEDED The 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.
400 MANAGER_INVALID The specified manager bot is invalid.
400 MANAGER_PERMISSION_MISSING The specified manager bot does not have the user.bot_can_manage_bots flag set.
400 NAME_INVALID The specified bot name is invalid.
400 USERNAME_INVALID The provided username is not valid.
400 USERNAME_OCCUPIED The provided username is already occupied.
400 USERNAME_SUFFIX_MISSING The required bot suffix is missing from the passed username.

Related pages

Deep links

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.