get_managed_bot_token()

Client.get_managed_bot_token()

Fetch the HTTP Bot API token for a managed bot.

Usable by Users Bots

Parameters:
  • bot_id (int) – Identifier of the managed bot whose token to retrieve.

  • revoke (bool, optional) – Pass True to revoke the existing token and generate a new one. Defaults to False.

Returns:

str – The bot token string in the standard 123456:ABC-DEF format.

Example

token = await app.get_managed_bot_token(bot_id=123456789)
print(token)