Home assistant and Telegram bot: Quick Answers
When quick responses show up under the message in the Telegram bot’s response, this is called Inline keyboard. This method of communication is very comfortable, it reminds of the usual menu navigation. We will do the same for our bot in this article.
To begin with, I recommend reading the articles Notifications in telegram from a smart home (RU) and Telegram: talking to a smart home (RU). Without the first one, nothing will work, and we will edit the automation from the second article.
In the automation of “ping-pong”, we will change just one word: telegram_command to telegram_callback. After clicking on the button in our menu, the old automation simply did not see the answer, although the content of the message was one-to-one. When we respond to a message with the buttons under the message, it is not the same as just a message in a chat to a bot.
And as a result, telegram no longer responds to the /ping command
We will create a new automation, like this one (RU), but the trigger will be /start, and we will respond not only with text, but also through the Inline keyboard. Below are the screenshots:
1. Enter the name and description
2. The event is the same as last time, only the command was changed to /start. 3. The action is also unchanged, only the text has been changed.
4. That’s the menu. We put a check mark on the Inline keyboard and write the following Light:/lghtbdrm, Info:/inf
The word before “: “is what will be displayed on the button, what is after is the command that will be sent in the response. We save, send /start to the bot and get our text and quick answers from below in response.
By clicking on the buttons, we can easily make sure that the bot is responding
After pressing the button, the clock symbol lights up on it. So, we can easily create a menu in any number of levels and implement home management only from telegram.
And that’s all, subscribe, likes, repost…