wrote by Nebojsa from Croatia
Telegram Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed. The Bot API allows you to easily create programs that use Telegram messages for an interface.
“Bots are third-party applications that run inside Telegram. Users can interact with bots by sending them messages, commands, and inline requests. You control your bots using HTTPS requests to Telegram Bot API“.
The ESP32 will interact with the Telegram bot to send messages to your Telegram account. This interface enable exchange messages and commands to or from KC868 A4/A8/A16.
Let me start with establishing a base by briefly introducing the functionality of the application. The application would then monitor a data range for certain events and notify users about any changes or newly added data. In fact, the whole parsing was an interesting problem to solve on its own, but today I’m concentrating on user interface design.
Creating a Telegram Bot
Go to Google Play or App Store, download, and install Telegram.
Open Telegram and go to create a Telegram Bot. First, go to Search and type “botfather” and click on the BotFather as shown below
The following window should open, and you’ll be prompted to click the start button.
Type /newbot and follow the instructions to create your bot. Give it a name and username. Mine is called ed-A4bot, and the username is KC868ESP32bot. User name must finished with bot.
If your bot is successfully created, you’ll receive a message with a link to access the bot and the bot token. Save the bot token because you’ll need it so that the ESP32 can interact with the bot.
Sending a Message to the Bot
You must send a message to your Telegram Bot from your Telegram account before it can send you messages. This is condition to Bot start work.
1) Go back to the chats tab, and in the search field, type the username of your bot (ed-a4bot).
2) Select your bot to start a conversation.
3) Click on the Start link.
And that’s it! You can proceed to the next section
Get Your Telegram User ID
To send a message to your Telegram account, the bot needs to know your user ID.
In your Telegram account, search for “myidbot” or open this link t.me/myidbot on your smartphone.
Start a conversation with that bot and type /getid. You will get a reply back with your user ID. Save that user ID, because you’ll need it later in this tutorial.