Introduction
Today we will be learning how to create a telegram bot and host it on heroku.Prerequisites
- A telegram account (duh!)
- Some experience with Python (for adding more features to the bot)
- A Heroku account -- Sign up here!
- A GitHub account -- Sign up here!
Create a telegram bot using Father Bot
- Search for @BotFather on Telegram
- Send message /newbot
- The bot will reply asking for a name for the bot, send whatever you like
- Next we have to chose a username for the bot, this must be unique and must end with bot. Example - testbot, telebot
- If the username is not unique, it will ask to enter again.
- That is it! You will receive a congrats message with a link and a token (copy paste it somewhere!)
- Your bot is right now dead and won't respond back :(, it needs a back-end server that is where Heroku comes in.
Deploying on Heroku
- Thanks to Kylmakalle, we have a good starter pack for Heroku telegram bot.
- Head over to https://github.com/Kylmakalle/heroku-telegram-bot#deploying-via-heroku-dashboard-gui and follow the instructions there.
- The starter pack python script has zero features. You can use https://github.com/python-telegram-bot/python-telegram-bot to add features (be sure to check out their wiki pages for documentation)
- That's it! Your bot is now alive :)
Thank you for reading this article.
If you have any doubts or questions, post down in the comments section below.
Don't forget to share this post to your friends and check out other awesome posts on tech-theka.blogspot.com
Comments
Post a Comment