Skip to content
Anton GoncharovAI systems developer

Web app · scenario · aiogram 3 code

Bot scenario builder

Not every business needs AI: booking a table or a wholesale request is a scenario with buttons and input validation. It’s convenient to build it and walk through it yourself first, and then get the code. The builder checks the scenario for dead ends and unreachable steps and exports an aiogram 3 bot that starts with a single command.

Scenario: Zerno coffee shop and roastery — fictional: table booking, a wholesale request, a post-purchase survey.

Demo screenshot: Bot scenario builder

Open the demo

Best on a computer: steps, preview and properties are visible at once. On a phone they’re in tabs.

The app runs in your browser: nothing is sent to a server.

What the demo shows

  • Six step types: message, buttons, question with validation, condition, jump and a final step with a lead

  • Answer validation: phone, email, number, date — with your own error text

  • A live Telegram-style preview: buttons, input errors and the lead card for the manager

  • Scenario checks: dead ends, unreachable steps, buttons without a jump, loops

  • A scenario diagram on React Flow — steps and transitions at a glance

  • Export: Python bot code for aiogram 3 with highlighting and the scenario as JSON, which can be loaded back in

How to try it

  1. Choose a template

    Coffee shop booking, a wholesale request or a post-purchase survey. The scenario starts in the preview immediately.

  2. Walk through the scenario

    Press “Table” and answer “eight” in words — the bot asks for digits. If there are more than 6 guests, a step about a private room appears.

  3. Change a step

    Select a step on the left and edit it on the right: text, buttons, validation, jump. Break a jump and the checks at the bottom show a dead end.

  4. Take the code

    The “Code export” tab: bot.py for aiogram 3 or the scenario JSON. The bot starts with a token from @BotFather and sends leads to the manager.

No paid neural networks

No neural network is needed here, and that’s a deliberate choice: in a scenario with buttons and input validation the bot behaves predictably, and leads arrive with the right fields. The generated code is checked in CI by compiling the Python for every template. Where a scenario hits free text, a production project adds a model — for example, to understand “there’ll be about eight of us”.

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

  • The same scenario in Telegram and Max, with leads going to amoCRM or Bitrix24
  • State stored in Redis so the conversation survives a bot restart
  • Reminders, payments and booking into a calendar or YCLIENTS
  • Free text where buttons aren’t enough: a model extracts the fields, the scenario validates them

Stack

  • React 19
  • TypeScript
  • React Flow
  • zod
  • Shiki
  • Zustand
  • Vite
  • aiogram 3

Based on

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

  • Book · Georgy Chelpanov

    A Textbook of Logic

    A bot scenario is checked like an argument: dead ends, unreachable steps, buttons that lead nowhere and loops are found before launch.

  • University course · CMC MSU

    Discrete Structures

    A bot scenario is a graph: dead ends, unreachable steps and cycles are found as graph reachability problems.

Developer’s comment

Anton Goncharov

AI systems developer · Python

For business

  • You can build and walk through the scenario yourself before paying for development: you see where a customer will get confused.
  • Phone, date and number validation means leads arrive with correct fields, and the manager doesn’t have to call back.
  • Booking and simple requests don’t need a neural network: a button-based bot is cheaper, more predictable and doesn’t make mistakes.

For developers

  • A scenario is data validated by a zod schema. From it come the React Flow diagram, the Telegram-style preview and the bot code.
  • The generator outputs bot.py for aiogram 3, and in CI the generated code of every template is compiled with Python so that export doesn’t break unnoticed.
  • Scenario checks look for dead ends, unreachable steps, buttons without a jump and loops.

Tips

  • Tip 01

    Store a scenario as data, not code: it’s easier to validate, diff and open in an editor.

  • Tip 02

    Test a code generator by its output: compiling the export catches more errors than string snapshots.

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
  • Telegram and Max · points, QR at the till, broadcasts

    live

    Loyalty program in Telegram and Max

    A bakery guest card right in the messenger: a QR code for the till that changes every minute, points and tiers, every sixth coffee free, points exchanged for coupons, bonuses for friends and segmented broadcasts with marketing consent.

    • Python
    • Telegram and Max