Skip to content

Mini-App (MiniApps) Events

Handling Telegram bot events that occurred in a store-format mini-app

Creating a mini-app event handler

Information

Before creating an event handler, first create a new scenario that will be launched by this event.

To set up mini-app event tracking, go to the "Messenger and app events" section and open the "MiniApp" tab.

miniapp events

Mini App tab

Click "Create" and select the required event. For details on all events, see Mini App event list

mini-app events

Event selection

In the event creation form, fill in the name, select a scenario, and activate the event.

miniapps in telegram

Event handler settings page

Mini-app event list

Event nameEvent descriptionVariables available in the scenario
Store launched via buttonUser launched the store via a button-
Store launched via linkUser launched the store via a link-
Checkout page openedUser navigated to the checkout page

  • miniapp_cart_json – JSON variable with the cart item list
  • miniapp_cart_text – cart contents in text format
  • miniapp_products_quantity – total quantity of all products
  • miniapp_cart_price – total price of all products in the store currency
  • miniapp_currency – currency
Order created (order placed)User placed an order

  • miniapp_cart_json – JSON variable with the cart item list
  • miniapp_order_number – variable with the order number
  • miniapp_cart_text – cart contents in text format
  • miniapp_products_quantity – total quantity of all products
  • miniapp_cart_price – total price of all products in the store currency
  • miniapp_currency – currency
  • miniapp_payment_method – payment method:

    • CASH_PAYMENT – cash,
    • ONLINE_PAYMENT – online
  • miniapp_delivery_method – delivery method:

    • SELF_PICKUP – pickup,
    • SHOP_DELIVERY – store delivery
  • miniapp_phone – phone specified in the order
  • miniapp_shipping_address – delivery address
  • miniapp_cart_price – total price of all products in the store currency
  • miniapp_shipping_price – delivery cost
  • miniapp_total_price– total order cost
  • miniapp_comment – comment
Cart createdUser added a product to an empty cart.

  • miniapp_cart_json – JSON variable with the cart item list
  • miniapp_cart_text – cart contents in text format
  • miniapp_products_quantity – total quantity of all products
  • miniapp_cart_price – total price of all products in the store currency
  • miniapp_currency – currency
Order status changedOrder status changed (automatically or manually)

  • miniapp_order_status:

    • Cancelled – cancelled
    • Formed – formed
    • Paid – paid
    • Completed – completed
  • miniapp_cart_json – JSON variable with the cart item list
  • miniapp_order_number – variable with the order number
  • miniapp_cart_text – cart contents in text format
  • miniapp_products_quantity – total quantity of all products
  • miniapp_cart_price – total price of all products in the store currency
  • miniapp_currency – currency
  • miniapp_payment_method – payment method:

    • CASH_PAYMENT – cash,
    • ONLINE_PAYMENT – online
  • miniapp_delivery_method – delivery method:

    • SELF_PICKUP – pickup,
    • SHOP_DELIVERY – store delivery
  • miniapp_phone – phone specified in the order
  • miniapp_shipping_address – delivery address
  • miniapp_cart_price – total price of all products in the store currency
  • miniapp_shipping_price – delivery cost
  • miniapp_total_price– total order cost
  • miniapp_comment – comment

Example contents of the miniapp_cart_json variable

[
  {
    "categories": ["Clothing", "T-shirts"],
    "currency": "RUB",
    "image": "https://storage.leadteh.ru/miniapp/example123/image1.png",
    "name": "T-shirt without options",
    "options": [],
    "price": 1200,
    "quantity": 1,
    "video": "https://video.ru/video1/"
  },
  {
    "categories": ["Footwear", "Sneakers"],
    "currency": "RUB",
    "image": "https://storage.leadteh.ru/miniapp/example456/image2.png",
    "name": "Sneakers with parameters",
    "options": [
      "42", 
      "Black"
    ],
    "price": 4500,
    "quantity": 2
  }
]

Handling an event in the bot scenario

If the constructor has a created and active event handler, when the event triggers, the scenario you specified in the handler settings will launch. In this scenario, event variables will be available — see the variable list in the table #Mini App event list

You can use these variables like any other variables, for example, add them to a Message Chain block text or check variable values with a Condition block.

Information

Important! These variables are local.

miniapps store

Using a variable in a Message Chain block

miniapps store

Using an event variable in a Condition block

Creating an online store in Telegram with mini-app events — sales automation and customer retention

Video lesson on creating an online store in Telegram using app events.

Learn how to set up a product catalog, integrate with YooKassa, create an automatic promo code sending system for abandoned carts, configure order notifications, and fully automate the sales process without programming.

🎁 Free course on chat bot and mini-app development for all users with an active PRO subscription is already available on LEADTEX.

10 detailed lessons covering everything from A to Z.

Start learning now — Start learning.