Creating a Telegram Bot


Follow these steps to connect your bot to Telegram:

  1. In Flow XO, click Bots in the top menu bar, then choose +New.
  2. Now choose Telegram as the messaging platform.
  3. Type in a descriptive name for the bot.
  4. Next, you should follow this link to start a conversation with the @BotFather and create a bot using the "/newbot" command. You'll find more detailed instructions on the Telegram site.
  5. After you've created the bot, you'll be given a token. Copy this as you'll need to paste it into Flow XO.
  6. To support all the available message types, you'll also need to "/setinline" to enabled (for mention or direct mention) and "/setprivacy" to disabled (for overhear) in BotFather. We'll explain how next.
  7. To enable inline support, message @BotFather with "/setinline". When he asks, choose the bot you just created. Now you'll be asked to give a placeholder message. Type something here, we suggest a generic "Ask something". You should then see a message saying your inline settings have been updated.
  8. By default, Telegram bots can only hear messages directed at them. To enable overhear commands (if you need them), you should disable privacy. It's good practice to leave privacy enabled unless you actually need to overhear. Message @BotFather with "/setprivacy". You'll then be asked to choose a bot. Now type "disable" to change the privacy mode, and finally you should see a success message.
  9. Back in Flow XO, type in your new bot's username and paste in the token you were given earlier by @BotFather.
  10. Finally, save the bot. The bot is now up and running!
  11. The last step will give you details about how to distribute your bot to other users.

Distributing Your Bot

To distribute you bot to other users, you can use a link in this format:{username}

Where {username} is your bot's username. This will allow any Telegram user to start talking to your bot. Of course, the person clicking the link must to be signed up and ready to use Telegram on their device.

If you'd like to give people a link to allow them to add your bot to their group, you can use this link format:{username}?startgroup=1

Again, replace {username} with your bot's username.

Customizing Your Bot

There are a lot of optional settings that you can update with @BotFather that will improve how your bot appears and give your users more idea about what it does.

You can read about all the bot settings over at Telegram.

Start Button

When the user connects to the bot for the first time (they click the 'START' button in Telegram), the message '/start' will be sent to the bot. You can look for the presence of this to know that the user clicked 'START' and welcome the user for the first time. The start message may also have optional arguments in the case of a deep linking (a way to drive traffic to specific flows using URLS). Please see how to work with commands here and how to set them up in Telegram with auto-complete for your users here

Telegram Specific Features

Telegram has a lot of powerful features that are unique. Because Flow XO supports many channels, not just Telegram, our standard flow building tools cannot take advantage of many of these features. However, if you are building Telegram specific flows you can take advantage of these from within Flow XO by using our Telegram Actions integration, which provides easy access to most Telegram bot functionality.

Let us know how we can improve Flow XO on our feedback site.

Still need help? Contact Us Contact Us