Zimmer Samarqand — QR code promotion in a Telegram bot

We built a QR code promotion with a Telegram bot for a Samarkand brand: a buyer scans a sticker, starts the bot and joins the customer base and the draws. Staff run batches of up to 150,000 codes, printing, Excel export and draws in an admin panel.

Client
Zimmer Samarqand
Project type
Web application
Open the app
Zimmer Samarqand — QR code promotion in a Telegram bot

Challenge

Zimmer Samarqand is a brand from Samarkand that puts a QR sticker on its goods, and every sticker carries a code of its own. A buyer registers that code in a Telegram bot and joins a promotion with prize draws. The brand's staff run the promotion themselves: they issue codes, print stickers and hold the draws.

The brand wanted to know its buyers and reward them with prizes. The idea of the QR code promotion is simple: every product carries a sticker with a code, and the buyer scans it with a phone to become a participant. No website or mobile app is needed — the link inside the QR code opens a Telegram bot, so there is nothing to install, no account to create and no form to fill in. The whole path is to scan the code and tap one button. Every registered code adds a person to the customer base: name, Telegram username and, if they choose to share it, a phone number. The brand uses that base for prize draws, for reaching winners and for seeing how many buyers responded.

The hard part is trust. A sticker can be photographed in a shop, forwarded to a friend or scanned twice. Two people can send the same code in the same second, and Telegram sometimes delivers one message again. If a code counted twice in any of these cases, the draw would stop being fair. The second hard rule: printed stickers must keep working forever. The code format, the link and the bot's username cannot change after printing, or thousands of stickers on the goods become useless, and losing the database would void every printed code at once. Anyone who sees a sticker in a shop can register it, so we advise putting it inside the packaging and asking winners to show it.

Batches run to tens of thousands of stickers, and they are printed in different ways: on A4 sheets or on rolls of labels in a thermal printer. Every printer shifts the image a little, yet a QR code on a small sticker still has to scan reliably with a phone camera. The admin panel is used by the brand's staff, not by developers — in Uzbek or Russian, and not only on a computer. The server is shared with other projects, so the promotion must not take CPU and memory from its neighbors. Names and phones are personal data, and the bot's access key gives full control over it: neither may reach the wrong hands.

We defined success like this. A buyer scans a code and gets a clear answer in Uzbek after a single tap. A staff member issues a batch on their own, prints the stickers, sees the participants and exports them to Excel. The draw is transparent: every code is a chance, and one person never wins twice in the same batch. Staff call or message the winners themselves, so the phone and username have to be at hand. The owner can rely on the data: the database is copied every hour, and an update that fails its checks rolls back to the previous version by itself. The promotion has to handle print runs of any size without needing a developer for everyday work.

Solution

We built the QR code promotion from three parts: a Telegram bot registers the codes, an admin panel runs batches, printing and draws, and the database itself makes sure every code works only once.

We wrote the server side in C++ on the Drogon framework and gave it strict limits: on the shared server it gets one CPU core and 512 MB of memory, so the neighboring sites never suffer. Telegram passes it every message, and in one step it registers the code and the participant and replies within the same exchange, so it never needs the bot's key at all; that key is used only when updates are deployed. The bot speaks only Uzbek, staff edit all 8 of its messages in the admin panel, and an edit applies from the very next reply. It asks for a phone number with a button but does not insist, and it ignores group chats and other bots.

We built the admin panel on React Admin, a ready base for tables, filters and forms. It has six sections: QR batches, participants, draws, codes, bot texts and users. The panel works in Uzbek, Russian and English, in light and dark themes, and on a phone its tables turn into cards. The sticker PDF is assembled right in the browser, so printing never loads the server while the bot is answering buyers. Staff sign in with a login and password, and there is no public sign-up. The application ships as a Docker image: every version is kept whole and the previous one can be restored at once, and GitHub Actions deploys a new one only after all checks pass.

  1. Every code works only once

    The ban on registering a code twice is built into the database itself, so a code cannot count twice even if the application has a bug. If two people send the same code in the same second, one of them gets it and the other gets a refusal, and a dedicated automated test checks exactly that. A repeated tap by the code's owner changes nothing, and a deleted code is never issued again.

  2. Batches of up to 150,000 codes

    A batch of 1 to 150,000 codes is created in one step and appears either whole or not at all; on the production server the largest one takes about 16 seconds. Every code is 16 random letters and digits, so guessing someone else's is practically impossible. The link is short, so the QR code stays compact and scans even from a 20 mm sticker. A batch with used codes cannot be deleted.

  3. Sticker printing in the browser

    The print PDF is built right in the staff member's browser, in the background, without freezing the page: A4 sheets with 54 stickers of 30 mm, or one sticker per label for a thermal printer. Size from 20 to 50 mm, margins, gaps and offsets are tuned to the actual printer, a test sheet with a 50 mm ruler checks the setup, and any range of numbers can be reprinted. A layout that pushes a code off the page never reaches the printer.

  4. Participant base and export

    Everyone who registers a code joins the base: name, username, language, phone if they shared it, and the number of codes. The list can be searched, filtered by date and exported to Excel up to 300,000 rows or to CSV with no limit; the file is assembled in parts of 20,000 rows, so the server is never overloaded. A formula typed into a Telegram name never runs in the export, and a participant's card lists all of their codes.

  5. A fair prize draw

    A draw picks 1 to 1,000 different people from one batch in a single step. Every registered code is a separate chance, codes from other batches do not count, and the database itself keeps one person from winning twice in a batch, even when two draws run at the same moment. A batch can be drawn again without its previous winners, and results are kept even if the batch is deleted later.

  6. Safe updates and database backups

    Every update first passes automated tests: the server is checked, the admin panel is built, and the QR codes are read back from a finished PDF the way a scanner would read them. A copy of the database is taken before each release, and a version that fails to start properly rolls back to the previous one by itself. The database is copied every hour, copies are kept for 48 hours, and the admin panel opens only over a secure HTTPS connection.

Results

The project's key outcomes in numbers.

  • 150kCodes in one batch

    The largest batch of 150,000 codes appears on the production server in about 16 seconds, either whole or not at all.

  • 1Tap to join

    A buyer only scans the sticker and taps one button in Telegram, with no sign-up, no forms and no separate app.

  • 1000Winners per draw

    One draw picks up to 1,000 different participants of a batch, and nobody can win in that batch more than once.

  • 54Stickers per A4 sheet

    By default an A4 sheet holds 54 stickers of 30 mm, while size, margins and offsets adjust to the printer.

Project tech stack

The stack we used to build the solution for the client's task.

  • C++
  • Drogon
  • PostgreSQL
  • Docker
  • Nginx
  • GitHub Actions
  • TypeScript
  • React
  • Vite
  • MUI
  • React Admin
  • Telegram Bot API

Ready to become the next case?

Tell us about your task — a manager will assemble the team, calculate the estimate and send a proposal within the first hour after the request. No obligations, no drip campaigns.