Telegram Business Bots

Telegram's business accounts, "Telegram Business", allow you to host a bot inside direct private chats with your users, among other features.

This allows you to automate private chats users have with your business without making them connect directly to your bot, or join a group or channel.

Flow XO has support for Telegram Business Bots, and for the most part there isn't anything you have to do on the Flow XO end once you've connected a bot to your Telegram account.

There are however a few special messages and metadata fields you might find useful.

1. When a business adds your bot to their Telegram account, the bot will received a special message with the text:

"business_connection:enabled"

This will also establish a private chat with the owner of the account that added your bot, so it is a good time to do any onboarding or welcoming that can orient the business owner to your bot

2. When a business removes your bot from their Telegram account, the bot will receive this special message:

"business_connection:disabled"

Again, you have a chance to message them to say goodbye, ask for feedback, etc.

We recommend, if you enable your bot for Business Accounts, adding two flows with Command triggers, one for businesses connecting to your bot, and one for business disconnecting. They should be "high priority" commands so that no other flows will ever receive these message. Here's what the "Connecting" flow might look like:

3. Messages that are sent to your bot via a business connection will have two additional metadata fields:

"business_connection_id" and "is_business_message"

You normally won't need these, but if you are planning custom logic for business-account users, you can use these data points.

One other item to note is that for users that chat with your bot through a business account, the response path will be different than usual. Instead of the usual {botId}/c/{channelId} the format will be {botId}/c/{channelId}~{businessConnectionId}

Normally you don't need to care about, or even know this, but if you are constructing response paths directly for some reason, this is an important point because business chats cannot be send to an end user without the business connection ID being present in the response path.

That's it,

Happy flowing!

Still need help? Contact Us Contact Us