How to make a Telegram bot with Xenioo

In this tutorial we’re going to learn how to set up a bot for Telegram using the Xenioo platform. It just takes a few easy steps!

Just like Facebook Messenger, Telegram allows you to run chatbots to automate conversational flows with subscribed users. And unlike other platforms, Telegram can even manage conversations between a group of users. And as usual: there are no changes to your bots, and everything is included in all the plans(even the free plan!).

Since Xenioo uses a seamless integration with all the supported platforms ,nothing will change the way you create your chatbotsThe great news is that you can pick any of your existing chatbots, and make them run on Telegram right now! All you need is a valid Telegram bot API key.

How to set up a Telegram bot

Telegram uses an interesting approach to bot API key creation: to create a bot, you need to talk to a bot which is appropriately called “The Botfather”.

In order to chat with BotFather, just add him to your Telegram contacts list and start chatting.

After this initial greeting, you will be presented with a list of commands: the first command that we are looking for is, of course: /newbot.

As soon as you send this command, BotFather will ask you for a full display name (the name that other users will see), and a bot user name (an internal name that will mostly just be of interest to you).

The creation is almost immediate: once BotFather has finished, he will present the link to you so you can use it to share to your new bot account with the API key. Copy this key as we will need it later for Xenioo.

To finish off your bot, you can go ahead and specify the avatar picture you would like. This is also done through chat commands: type /setuserpic, and then follow BotFather’s instructions for uploading your bot avatar image.

All the information you give to BotFather is saved and kept throughout the chat session. If you later wish to change your picture, create a new bot, or change the API key, just go back to  BotFather, as he will know all about your bots.

How to publish your chatbot on Telegram

Now that Telegram has created your new API key, it is time to make your chatbot live.

As you normally do on Facebook, Slack and Web Site, just click on the publish button to open up the channels configurations. But this time of course, you’re going on Telegram.

Now go to the Telegram settings dialogue and paste the API key that you’ve been given by BotFather, and save to confirm.

Click on the publish button, and within a second, your chatbot will be online!

If your new chatbot is not already in your Telegram contacts, all you need to do is to search for it using the Telegram search functionality, and start talking to it to see it running.

Much like Facebook’s first contact, Telegram also uses a Get Started button that will initiate a bot conversation: this is all automatically managed by Xenioo.

Groups, Text and Privacy

 

Once your chatbot is online, you can interact with it in exactly the same way you interact with other Xenioo communication channels.

What you write is sent to Xenioo, and the text you send can be used to activate complex commands or dialogues.

An interesting feature of Telegram is the ability to create conversation groups in which you can invite multiple users. Within these groups, multiple users (up to 100,000!) can simultaneously discuss and interact with each other. This is one reason why Xenioo have added Telegram!

A group can also have bots within it, and your bot created by Xenioo can be simply added by searching for it in the Telegram interface.

Once you have added your chatbot to the group, you will notice a particular behaviour: what you write in the group is not interpreted by the chatbot unless it is preceded by a slash (/). This is a default setting implemented by the Telegram bot, and is strategically designed to avoid traffic: generally speaking, a bot within a group is thought to participate as an external helper, and is not set up to intervene on what users may say.

In some cases, however, you may want to ensure that your chatbot activates whenever any person in the group says a particular word or phrase. In this case, the settings of your bot must be changed through BotFather.

To connect to BotFather again, use the /setprivacy command for your bot. Follow the instructions in chat so you can configure your bot to only respond to slash commands, or to receive any conversation.

Again, for Xenioo these settings are transparent, and will react correctly based on your configuration.

Single and Group Conversations

The management of conversations within Xenioo fully supports all Telegram’s features.

As with Facebook, Web Site and Slack, with Telegram, you can also view the entire history of conversations with your users, and eventually take over, thereby gaining full control.

Telegram groups are also fully supported!

In fact, you will be able to view both single conversations and group conversations, and in the latter case, by taking control of them, you will be able to talk to the whole group at the same time!

All Telegram features are already available and enabled in all Xenioo accounts for free!

If you are not yet registered, then there is no better time to start exploiting all Xenioo’s cutting-edge options to help drive your success!

Gianandrea is Matelab Srl co-founder and co-creator of Xenioo.
When not creating cutting edge business application solutions or chatbots plotting world domination, he can be found online, probably shooting aliens.