Get your API key

Lesson 3 of 5

Buttons, orders and daily reminders

Order tomorrow's lunch in four taps, save orders, alert the owner, and send reminders only to people who said yes, within Telegram's limits.

9 min Log in to open
One step at a time, like flipping pages.

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

  1. 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.
    On the left, the customer's chat: the bot asks what they would like tomorrow with three item buttons, then how many with buttons 1 to 4, then a time slot with two buttons, then a summary of 2 Paneer thali for 240 rupees with Confirm and Cancel, then "Order #42 confirmed". An arrow goes from Confirm to the owner's chat on the right, which shows "New order #42" with the details.
    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.

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:

  1. A short order conversation that remembers each step
  2. Tell the owner about every new order
  3. Daily reminders, only with permission
  4. Stay inside Telegram's limits
  5. Recap