By the end of this lesson your bot will take tomorrow's lunch orders with buttons, save them, send each new order to the owner, and send a daily reminder only to customers who said yes.
You need: the bot from lesson 2 running on your laptop, and a second Telegram account or a friend's phone for testing the owner side · Time: 9 minutes
An inline keyboard is a set of buttons shown right under a bot message. When the customer taps one, Telegram does not post a chat message; it sends your code a small hidden label, the callback data (at most 64 bytes, for example
item:paneer).Two details your agent must get right:
- Answer every tap. Telegram shows a small loading spinner on the button until your code answers (the method is
answerCallbackQuery). Forget it, and the bot looks frozen. - Never trust the label for money. The label only says which item was tapped. The price always comes from your own menu file.
Four taps for the customer, one message for the owner. No typing, no spelling mistakes. Why?With typing, customers write "panner thaali 2 plz", and your code has to guess. With buttons, every order arrives in the same shape, so saving, counting and reminders become simple.
- Answer every tap. Telegram shows a small loading spinner on the button until your code answers (the method is
Log in free to read the rest of this lesson
Every lesson is free. A free account unlocks all of them and saves your progress.
Still to come in this lesson:
- A short order conversation that remembers each step
- Tell the owner about every new order
- Daily reminders, only with permission
- Stay inside Telegram's limits
- Recap