Telegram HTTP API With Python — Sending Messages Programatically
Perhaps you’re training a machine learning model and wish to notify yourself through Telegram when it’s done training. Perhaps you have some sort of service and wish to notify yourself whenever someone makes a call to your service. In this article, we’ll run through how to send a message with a Telegram bot using Python from start to end.
1) Create A Telegram Bot Using BotFather
The very first thing we need to do would be to create a Telegram Bot, and we can do this using BotFather (Search “BotFather” in your search bar)
- Type
/newbot
to tell BotFather that you wish to create a new Telegram bot - Choose a name and username for your Telegram bot
- A token will be generated for your newly created Telegram bot — We will need this in our code later
Note: please don’t share your Telegram bot token with anyone — anyone with your token can take over control of your Telegram bot.