Telegram Mini Apps Explained: Build Web Apps Inside Telegram
Telegram Mini Apps (formerly Web Apps) are web applications that run inside the Telegram interface. They enable rich interactive experiences, from games to e-commerce, all within the Telegram app.
How Mini Apps Work
Mini Apps are essentially web pages loaded in an in-app browser with access to the Telegram JavaScript API. They can:
- Access the user's Telegram name, username, and User ID.
- Send data back to the bot that opened the app.
- Accept payments via Telegram Stars or third-party payment providers.
- Use native UI elements like haptic feedback, popups, and theme colors.
Types of Mini Apps
- Bot menu apps: Opened from a bot's menu button. Full-screen experience.
- Inline apps: Launched from an inline keyboard button in any chat.
- Direct link apps: Opened via t.me/botname/appname deep links.
- Side menu apps: Pinned in Telegram's side navigation (newer feature).
Building a Mini App
- Create a bot via @BotFather.
- Build a web application (HTML, CSS, JS) hosted on HTTPS.
- Include the Telegram Web App JavaScript library:
<script src="https://telegram.org/js/telegram-web-app.js"></script> - Use
Telegram.WebAppto access user data and interact with Telegram. - Configure the Mini App URL via @BotFather using
/setmenubuttonor/newapp.
User ID in Mini Apps
When a user opens your Mini App, you receive their User ID through the init data. Use TelegramUserID.com to test username-to-ID lookups during development.
Frequently Asked Questions
Are Telegram Mini Apps free to build?
Yes. There is no cost to create or publish Mini Apps. You only need hosting for your web application. Telegram does not charge developers. You can use free hosting like Cloudflare Workers or Vercel.
Can Mini Apps accept payments?
Yes. Mini Apps can accept payments via Telegram Stars (Telegram's in-app currency) or through integrated payment providers (Stripe, etc.). Telegram Stars are particularly popular because they allow instant in-app purchases without leaving Telegram.