Business Bot Features
Several business features have been added for premium users to Telegram.
In particular, premium users can now select a bot to act as a chatbot on their behalf, in order to manage/reply to messages from other users (typically, their business customers).
BotFather configuration
First, the bot owner need to talk to @BotFather and go to the Bot Settings to enable Business Mode
In the following sections, we will refer to the premium user using your chatbot as "the business owner".
BusinessConnection update
Once your chatbot is configured, the business owner has to go to their account settings, under Telegram Business > Chatbots and type your bot username.
At this point, your bot will receive an update.BusinessConnection
which contains:
- a unique id (you may want to store this)
- details on the User (business owner)
- IsEnabled (false if the business connection got cancelled)
- CanReply (if the bot can act on behalf of that user in chats that were active in the last 24 hours)
You can retrieve these info again later using GetBusinessConnectionAsync(id)
BusinessMessage updates
From now on, your bot will receive updates regarding private messages between users (customers) and the business owner:
update.BusinessMessage
: a customer sent a new message to the business ownerupdate.EditedBusinessMessage
: a customer modified one of its message sent to the business ownerupdate.DeletedBusinessMessages
: a customer deleted some messages in private with the business owner
In these messages/updates, the field BusinessConnectionId
will tell you which BusinessConnection this applies to
(useful for context if your chatbot is used by several business owners)
Acting on behalf of the business owner
If the business owner enabled "Reply to message" during the initial business connection, your bot can reply or do some other actions on behalf of their user account.
To do so, you can call many Bot API methods with the optional businessConnectionId: parameter.
This way your bot can send/edit/pin messages, send chat actions (like "typing"), manage polls/live location, as if you were the business owner user.
Some notes about messages sent on behalf of the business owner:
- They will NOT be marked with your bot name from the customer point of view
- They will be marked with your bot name in the business owner private chat (a banner also appears on top of the chat)
- These features are limited to private chats initiated by customers talking to the business owner.