Skip to content
Anton GoncharovAI systems developer

Telegram and Max · points, QR at the till, broadcasts

Loyalty program in Telegram and Max

Plastic cards get lost, and nobody installs a coffee shop’s app. A card in Telegram or Max takes a minute to set up and is always at hand: the cashier scans the QR, points arrive instantly, and a minute later the bot asks you to rate the visit. Here you get to be the guest, the cashier and the marketer: ring up a receipt, exchange points for a gift and receive a broadcast the way a guest would see it.

Scenario: Kolos Bakery chain, Yekaterinburg — fictional: coffee, breakfasts and cakes, three card tiers, gifts for points and a base of 1,248 guests for broadcasts.

Conversation with the bot: Loyalty program in Telegram and Max
The replies are real — captured from the bot’s code and styled like Telegram. The bot speaks Russian.

Open the demo

The bot replies in Russian: it was built for Russian-speaking customers. Example phrases come with translations.

Don’t enter real personal data: this is a demo, and everything is deleted after 24 hours.

What the demo shows

  • Sign-up in three steps: phone, birthday and consent to promotions — 200 points as a gift

  • The card’s QR code changes every minute, like banking app codes: the till won’t accept a screenshot of someone else’s card

  • Tiers by total spend: 5, 7 and 10% back in points, pay up to 30% of a receipt with points, double points in your birthday week

  • Stamps: every sixth coffee free, as a coupon with a QR code

  • Points for gifts: a croissant, a coffee, a cake — the coupon is valid for a week

  • Invite a friend by link: they get points right away, you get yours after their first purchase

  • Segmented broadcasts — “haven’t visited in a while”, birthdays, gold guests — only to those who gave consent

  • Visit rating a minute after purchase: a low score goes straight to the manager, and the guest gets a coffee on the house

  • Pressing “Ring up” twice won’t credit points twice

  • One codebase for Telegram and Max

How to try it

  1. Get a card

    Press “Получить карту” (Get a card), enter any number like +7 900 000-00-00 and a birthday — you’ll get a card with a QR code and 200 points.

  2. Be the cashier

    “Я на кассе” (I’m at the till) under the card: pick a receipt, redeem points or keep saving — the bot sends the receipt, the points and a stamp.

  3. Test the protection

    Wait a couple of minutes and press “Я на кассе” under the old card — the QR has expired, and the bot sends a fresh one.

  4. Send yourself a broadcast

    /admin — segments as the marketer sees them: pick a segment and receive the message and coupon as a guest.

What to write

  • Сколько у меня баллов?How many points do I have?
  • Покажи подаркиShow me the gifts
  • Хочу пригласить другаI want to invite a friend

Commands

/start
start
/card
card and QR code
/gifts
exchange points
/history
points history
/invite
invite a friend
/admin
broadcasts as the marketer sees them
/promo
turn promotions on or off
/about
how the demo works

No paid neural networks

No neural network is needed here: points, tiers and segments are calculated by rules. The till is simulated: in a production project the cashier scans the QR in the POS software, and the bot receives the receipt via API.

The demo runs without OpenAI, YandexGPT or GigaChat API keys. Wherever a production system calls a model, there’s a local stub with the same interface — so the demo is free, always available and never makes things up.

What a production project adds

  • POS and accounting: iiko, r_keeper, Evotor or 1C — the cashier scans the QR, and the receipt and points arrive via API
  • Guests and segments in a CRM, with segments recalculated nightly from purchase history
  • Scheduled broadcasts that respect time zones and frequency limits, with open and return reports
  • Reviews: happy guests go to Yandex Maps and 2GIS, unhappy ones to the manager with their visit history
  • A verified phone via the “Share contact” button and a single card for Telegram and Max

Stack

  • Python 3.14
  • aiogram
  • Max Bot API
  • segno (QR)
  • SQLAlchemy
  • SQLite

Based on

Books and university courses whose ideas are at work in this demo.

  • Book · Bruce Schneier

    A Hacker’s Mind

    The card’s QR code changes every minute: the till won’t accept a screenshot of someone else’s card — the loophole is closed before release.

  • Book · Kelly McGonigal

    The Willpower Instinct

    “Every sixth coffee free” stamps and guest levels: a reward for a habit people want to come back to.

Developer’s comment

Anton Goncharov

AI systems developer · Python

For business

  • A card in the messenger doesn’t get lost and needs no app: signing up takes a minute right at the checkout.
  • Points, stamps and gifts bring guests back, and a “we haven’t seen you in a while” message brings back those who started to forget.
  • A rating right after the visit catches unhappy guests before they write a review on the maps.

For developers

  • The QR code is calculated like TOTP: an HMAC of the card secret and the minute number; the checkout accepts only a fresh one.
  • Each receipt is processed once: a repeated tap or a repeated request won’t award points twice.
  • The QR image is a PNG in memory: Telegram receives it as a file, Max via attachment upload, with one scenario.

Tips

  • Tip 01

    Without advertising consent, send only accruals and redemptions: Russian advertising law forbids promotions to such guests.

  • Tip 02

    Give the referral bonus after the friend’s first purchase, not after sign-up — otherwise it will be gamed.

Want the same for your business?

Tell me about your task — I’ll tell you what from the demo fits, how long it will take and what I’ll need from you.

Other demos in this section

All demos
  • Telegram and Max · knowledge base search

    live

    AI support from a knowledge base

    A first-line bot answers customers from the company knowledge base, shows the source of each answer, honestly says “I don’t know” and hands the conversation to an operator.

    • Python
    • Telegram and Max
  • Telegram and Max · leads and CRM

    live

    Lead qualification

    The bot takes a request in free-form text, pulls out the task, budget, timeline and contact, rates how “hot” the lead is and puts a card on the deal board.

    • Python
    • Telegram and Max
  • Telegram Mini App · payment · statuses

    live

    A store in Telegram

    A catalog as an app inside Telegram, a cart, test payment and order status notifications — from “packing” to “delivered”.

    • Python
    • Telegram and Max
    • React
  • Telegram and Max · booking, prepayment, reminders

    live

    Service booking in Telegram and Max

    The bot books barbershop appointments: service, barber and free time via buttons or in a single phrase, prepayment, a reminder with “I’ll come” and “Reschedule” buttons, rescheduling, cancellation and the schedule as the administrator sees it.

    • Python
    • Telegram and Max
  • Web app · scenario · aiogram 3 code

    live

    Bot scenario builder

    A booking or lead-collection bot is assembled from steps: messages, buttons, questions with phone or date validation, conditions. The scenario can be walked through right away in a Telegram-style preview, and the output is ready-to-run Python bot code.

    • React
    • TypeScript
    • Python