Chatbots are often touted as a revolution in the way users interact with technology and businesses.
Many industries are shifting their customer service to chatbot systems.
Chatbots deliver a degree of user support without substantial additional cost.

The same can be said of instant messaging apps, though with some caveats.
40% off TNW Conference!
Building a chatbot on Telegram is fairly simple and requires few steps that take very little time to complete.

The chatbot can be integrated into Telegram groups and channels, and it also works on its own.
Our example will involve building a bot using Flask and deploying it on a free Heroku server.
To complete this tutorial, you will needPython 3installedon your system as well asPython coding skills.

You also needGitinstalled on your system.
Of course, the tutorial also requires a Telegram account, which is free.
you might sign uphere.
A Heroku account is required, too, and you’re free to get it for freehere.
The name will show up for your bot, while the username will be used for mentions and sharing.
Code the chatbot logic
We will be using Ubuntu in this tutorial.
As for Mac users, this tutorial should work just fine.
First, lets create a virtual environment.
It helps isolate your projects requirements from your global Python environment.
Now we will have abotenv/directory which will contain all the Python libraries we will be using.
We also need to bind functions to specific routes.
In other words, we need to tell Flask what to do when a specific address is called.
More detailed info about Flask and routes can be foundhere.
We will call this function one time only, when we first create the bot.
Now we can progress to the last step, launching our app on Heroku.
Launch our app on Heroku
We need a couple of things before we make our app.
From your Herokudashboard, create a new app.
Once you do, it will direct you to theDeploypage.
If you seewebhook setup ok, that means you are ready to go!
More actions can be foundhere.
Many more simple examples of telegram bots can be found on thepython-telegram-botpage on GitHub.