TL;DR
- Telegram Mini Apps are web apps that run inside Telegram’s WebView, and each client (iOS, Android, Desktop, Web) behaves a little differently.
- Never trust user data sent from the client: validate
initDataon your server with the HMAC check described in Telegram’s documentation. - Digital goods and services inside Telegram must be sold for Telegram Stars; physical goods use external payment providers.
- Any blockchain features must use TON and TON Connect.
- Debug on real devices with Telegram’s built-in WebView inspection, Telegram’s test environment and a tunnel such as ngrok.
What are Telegram Mini Apps?
Telegram Mini Apps are web applications built with HTML, CSS and JavaScript that open inside Telegram, on top of a chat or full screen. They get the user’s Telegram identity at launch, can use native Telegram features such as payments, popups and haptic feedback, and require no installation. That combination (instant access plus a web stack) is what makes them attractive, and also what creates most of the challenges below.
| Telegram Mini App | Telegram Bot | |
|---|---|---|
| Interface | Full web UI (HTML, CSS, JS) | Messages, buttons and commands in chat |
| Best for | Games, stores, dashboards, complex flows | Notifications, quick commands, simple forms |
| User identity | Passed at launch via initData | Available in every update |
| Payments | Stars and external providers via invoices | Stars and external providers via invoices |
| Development effort | Frontend + backend + bot | Backend + bot |
For a deeper comparison of when to choose which, see Telegram Mini App vs Telegram Bot.
Technical Implementation Challenges and Platform Limitations
One app, several Telegram clients
A Mini App runs inside the WebView of whichever Telegram client the user has: iOS, Android, Telegram Desktop, macOS or Web. Each uses a different engine, and not every client supports every feature on the same day. The SDK exposes the client’s Bot API version and an isVersionAtLeast() method, so check for a feature before you call it and show a fallback when it is missing.[1]
Viewport, safe areas, fullscreen and the keyboard
The visible area changes as users expand the app or open the keyboard. Telegram provides viewportHeight and viewportStableHeight, also exposed as CSS variables (--tg-viewport-height, --tg-viewport-stable-height).[1] Lay out fixed elements against the stable height, or buttons will jump while the keyboard animates.
Bot API 8.0 added full-screen mode (requestFullscreen()), along with safeAreaInset and contentSafeAreaInset, which report the space taken by notches and by Telegram’s own controls.[1] In full-screen mode, those insets are the only reliable way to keep content away from the camera cutout and the close button. Bot API 9.1 added hideKeyboard() for closing the keyboard programmatically.[1]
| Storage | Added in | Limit | Where data lives | Use it for |
|---|---|---|---|---|
CloudStorage | Bot API 6.9 | Up to 1,024 keys per user; keys 1–128 characters, values up to 4,096 characters | Telegram’s cloud, synced across devices | Settings and small state that must follow the user |
DeviceStorage | Bot API 9.0 | Up to 5 MB per user | On the device | Caches and larger local data |
SecureStorage | Bot API 9.0 | Up to 10 items per user | iOS Keychain or Android Keystore, encrypted | Tokens and secrets |
Browser localStorage | — | Depends on the client’s WebView | Inside the WebView | Non-critical data only; it can be cleared |
Data in localStorage lives in a WebView that the Telegram client controls, so it can disappear when the cache is cleared or the user switches devices. Anything the user would miss belongs on your server or in CloudStorage.
Camera, location and QR codes
Browser access to the camera and geolocation inside a WebView is inconsistent across clients, so Telegram offers native alternatives. showScanQrPopup() (Bot API 6.4) opens Telegram’s own QR scanner and returns the decoded text, and LocationManager (Bot API 8.0) requests location through Telegram’s permission flow.[1] Use these instead of browser APIs whenever they cover your case.
Authentication and Security: Validating initData
When a Mini App opens, Telegram passes it initData: a query string with the user’s ID, name, auth_date and a hash. The frontend can read it, but the frontend cannot be trusted. Anyone can open your app in a browser and send a fake user ID to your API. The only safe identity is the one your server verifies.
Telegram’s documented check works like this:[1]
- Send the raw
Telegram.WebApp.initDatastring to your backend with every session request. - Build the data-check-string: all received fields except
hash, sorted alphabetically, askey=value, joined with line breaks. - Compute the secret key as HMAC-SHA-256 of your bot token, with the string
WebAppDataas the key. - Compute HMAC-SHA-256 of the data-check-string with that secret key and compare its hex value with
hash. If they differ, reject the request.
Check freshness. A valid initData string stays valid forever unless you check auth_date, the Unix time when the app received it. Reject anything older than your session window (for example, a few minutes for payments, a day for read-only sessions), and after validation issue your own short-lived session token. That way a leaked initData string cannot be replayed indefinitely.
Third parties. If another service needs to verify the user without your bot token, Telegram also signs initData with Ed25519. The third party checks the signature field against Telegram’s public key and your bot_id.[1]
Beyond initData, the usual web rules apply: HTTPS everywhere, server-side validation of every action that costs money or changes balances, and rate limits on endpoints that grant rewards.
Payments: Telegram Stars, Physical Goods and App Store Rules
Digital goods and services: Stars only. If you sell anything digital inside Telegram (in-game items, premium features, subscriptions, content), the payment must be in Telegram Stars, currency code XTR.[2] Users buy Stars through Apple and Google in-app purchases or through @PremiumBot. Telegram explains why: App Store and Google Play rules on digital goods mean Telegram cannot show a bot or Mini App to mobile users if it sells digital items outside Stars.[2]
The flow uses the standard Bot API payment methods: send an invoice (sendInvoice or createInvoiceLink, opened from the Mini App with openInvoice()), approve the pre_checkout_query, then deliver the goods after successful_payment. For digital goods, provider_token stays empty. Store the telegram_payment_charge_id, because you will need it for refunds via refundStarPayment.[2]
Physical goods: external providers. For goods and services delivered in the real world, you connect a payment provider through @BotFather and pass its provider_token. Card details are handled by the provider, not by your app.[2]
Getting the money out. Stars your bot earns can be spent on Telegram Ads or withdrawn as Toncoin through Fragment; each Star becomes eligible for withdrawal 21 days after it is earned.[3] The amount you receive per Star depends on Telegram’s current rate and on the app-store fee built into what the user paid. Check the Star Pricing table in Telegram’s payments documentation before you set prices, and plan your cash flow around the 21-day delay.
TON and Crypto Features
If your Mini App touches crypto at all (wallet connection, token issuance, NFTs, on-chain rewards), it must run on TON. On January 21, 2025, Telegram updated its terms for Mini Apps: any app that issues or distributes tokens or blockchain assets must use the TON blockchain, and wallets can only be connected through the TON Connect SDK.[4] Apps already running on other chains had to migrate to TON by February 21, 2025.[5]
TON Connect is the protocol that links a Mini App to a user’s TON wallet, such as Wallet in Telegram or Tonkeeper.[6] The user approves the connection and every transaction in the wallet, and your app never sees private keys. Two practical points follow:
- Prove wallet ownership on the server. Use TON Connect’s
ton_proofto confirm that the user controls the address before you tie it to an account or a reward. - Design for blockchain load. Large airdrops on TON have congested the network before (see the examples below). Spread claims over time instead of opening them to every user at once.
Bots without a Mini App are not covered by these rules, and bridging assets from other chains is still allowed through approved scenarios.[4]
Testing and Debugging: Ensuring Quality in Telegram Mini App Development
You can’t press F12 inside the Telegram app, so debugging takes some setup. Telegram documents a debug mode for each client:[1]
- iOS: tap the Settings icon 10 times, turn on Allow Web View Inspection, connect the phone to a Mac and open Safari → Develop.
- Android: enable USB debugging, long-press the version number in Telegram settings twice, turn on Enable WebView Debug, then open
chrome://inspect/#devicesin Chrome. - Telegram Desktop (Windows, Linux): in the beta version, go to Settings → Advanced → Experimental settings → Enable webview inspection, then right-click → Inspect.
- macOS: in the beta version, click the Settings icon 5 times and enable Debug Mini Apps.
Test environment. Telegram runs a separate test server with its own accounts and bots. It lets you test Stars payments without spending real Stars and allows plain HTTP links for local development.[1][2]
Tunnels. To open a local build on a real phone, expose it over HTTPS with ngrok or Cloudflare Tunnel and set that URL in @BotFather.
In-app console. When a cable isn’t practical, for example when a tester reports a bug from their own phone, add Eruda,[7] a JavaScript console that runs inside the page. Load it only in staging builds.
Test on each client you support, at minimum iOS, Android and Desktop, because layout, keyboard and storage behavior differ between them.
Step-by-Step Telegram Mini App Development Process
- Define the job of the app. Decide what users do in the first 30 seconds and why it must live in Telegram rather than on a website.
- Pick the launch points. Telegram supports several ways to open a Mini App: the bot’s menu button, inline buttons, keyboard buttons, direct links, inline mode, the attachment menu and the main Mini App on the bot’s profile.[1] Each affects which data you receive at launch.
- Design for the smallest screen and every client. Use Telegram’s theme variables, safe-area insets and the stable viewport height from the start.
- Build the backend around
initDatavalidation. Validate on every session request and issue your own short-lived tokens. - Add payments and crypto with the right rails. Stars for digital goods, a provider for physical goods, TON Connect for anything on-chain.
- Test on real devices and in the test environment. Cover each client, slow networks and the keyboard-open state.
- Launch gradually and monitor. Watch errors per client, payment failures and suspicious reward claims, and keep feature flags ready to switch off anything that misbehaves.
Real Examples
Notcoin: scaling a viral launch. Notcoin reached 35 million total players and a peak of six million daily active users in early 2024.[8] On May 16, 2024, it airdropped more than 80 billion NOT tokens on TON.[9] The challenge was handling a sudden spike: millions of users claiming at once, while wallets and exchanges also processed the new token. Lesson: design claims and withdrawals as a queue with clear status, not as a single moment.
Hamster Kombat: anti-fraud at 300 million users. Hamster Kombat said it had attracted 300 million players.[10] Before its September 2024 airdrop, the team banned 2.3 million accounts as cheaters, identified by analyzing behavior: one person had connected more than 400 accounts to a single exchange address.[11] When the airdrop ran, the TON network handled about 1.01 million transactions in one hour without interrupting block production.[12] Lesson: if rewards have real value, bots will come; plan device, referral and wallet-linking checks before launch.
Catizen: monetization with Stars. Catizen reached 34 million users in its first six months.[13] It sells its premium in-game currency for Telegram Stars, and by September 2024 it had earned about $25 million in revenue with more than a million paying users.[14] Lesson: Stars make in-app purchases feel native, so a Mini App can monetize through purchases rather than relying only on token rewards.
Checklist
- Validate
initDataon the server for every session. Why: the client can send any user ID; only the HMAC check proves it came from Telegram. - Reject stale
auth_datevalues and issue short-lived session tokens. Why: without an age check, a capturedinitDatastring works forever. - Check
isVersionAtLeast()before calling newer SDK methods. Why: users on older clients would otherwise hit silent errors. - Lay out against
viewportStableHeightand the safe-area insets. Why: the keyboard and full-screen mode change the visible area, and fixed buttons end up hidden. - Keep important state on your server or in
CloudStorage, not inlocalStorage. Why: WebView storage can be cleared or left behind when the user changes devices. - Sell digital goods only for Stars and store every
telegram_payment_charge_id. Why: app-store rules leave no alternative, and refunds need the charge ID. - Use TON and TON Connect for every on-chain feature. Why: other chains and wallet protocols break Telegram’s Mini App terms.
- Put rate limits and fraud checks on everything that grants rewards. Why: free value attracts bots and multi-accounts within days.
- Test on iOS, Android and Desktop with WebView inspection turned on. Why: each client renders and handles the keyboard differently.
- Load Eruda and test tools only in staging. Why: a console in production exposes internals and slows the app.
Conclusion
Most Telegram Mini App challenges come from one fact: a web app is running inside someone else’s client, under someone else’s rules. Handle client differences with feature checks and Telegram’s native APIs, make the server the only source of truth for identity, use Stars and TON Connect where Telegram requires them, and test on real devices before every release. If you are planning a Mini App, our Telegram Mini App development team can help you scope it, and our list of Telegram Mini App ideas for 2026 and the guide to in-game purchases in Telegram games cover what to build and how to monetize it.
Sources
- Telegram Mini Apps, Telegram, 2026
- Bot Payments API for Digital Goods and Services, Telegram, 2026
- Star Messages, Pinned Gifts, Verification Platform 2.0, and More, Telegram Blog, 2025
- Blockchain Guidelines, Telegram, 2025
- Telegram Requires Third-Party Wallets to Use TON Connect, Cointelegraph, 2025
- TON Connect Overview, TON Documentation, 2026
- Eruda: Console for Mobile Browsers, GitHub, 2026
- What Is Notcoin? The Telegram-Based Game and NOT Token Airdrop, Decrypt, 2024
- Notcoin Goes Live on TON Blockchain, Airdrops Over 80 Billion Tokens, The Block, 2024
- Telegram Game Hamster Kombat Claims 300 Million Players, Decrypt, 2024
- Why Hamster Kombat Purged Millions of Players From the Telegram Airdrop, Decrypt, 2024
- TON: Transaction Count Hits 30-Day High of 1.01M Transactions, CryptoQuant, 2024
- Telegram Clicker Game Catizen Reaches 800K Paying Users in First 6 Months, Cointelegraph, 2024
- Telegram Has Proven Itself as a Viable Platform for Crypto Gaming, Deconstructor of Fun, 2024
No comments yet. Be the first to comment!

