Home
telegram-webapp-sdk is a type-safe, ergonomic Rust/WASM wrapper around the
Telegram Web Apps JavaScript API. It
lets you build Telegram Mini Apps entirely in Rust — with vanilla WebAssembly,
or through first-class Yew and Leptos
integrations.
API coverage
The crate tracks the Telegram WebApp API version 9.6, which is the latest
Mini App surface exposed by telegram-web-app.js. Bot API has since advanced to
10.1, but versions 9.7–10.1 introduced no new WebApp methods, fields, or events,
so the covered surface is complete. Bot API 9.5 added icon_custom_emoji_id for
bottom buttons; 9.6 added WebApp.requestChat and the requestedChatSent /
requestedChatFailed events — both are implemented.
The covered surface includes:
- Buttons: Main, Secondary, Back, and Settings buttons
- Dialogs: alert, confirm, popup, and QR-code scanner
- Navigation, links, sharing, and invoices
- Theme, colors, viewport, and safe-area insets
- Storage: CloudStorage, DeviceStorage, and SecureStorage
- Sensors: accelerometer, gyroscope, device orientation, and LocationManager
- Biometric authentication and haptic feedback
For the full method-by-method checklist, see
WEBAPP_API.md.
Feature flags
The crate is default = [] — enable only what you need.
| Feature | What it enables |
|---|---|
macros | telegram_app!, telegram_page!, and telegram_router! for boilerplate-free apps and routing |
yew | use_telegram_context, reactive use_viewport / use_theme / use_safe_area hooks, and BottomButton / BackButton / SettingsButton components |
leptos | provide_telegram_context, the same reactive use_* hooks, and matching Leptos components |
mock | A configurable mock Telegram.WebApp for local development and testing |
full | Aggregates macros, yew, leptos, and mock |
telegram-webapp-sdk = { version = "0.11", features = ["leptos", "mock"] }
Documentation index
- Installation — dependency line, feature flags, MSRV, and the wasm32 target
- Quick Start — obtain the WebApp instance,
ready()/expand(), read init data, and wire up a MainButton - WebApp API — a tour of the covered surface grouped by area, plus the
*_with_callbackvsasyncpattern - Framework Integration — Leptos and Yew hooks and components
- Mock & Testing — the
mockfeature andwasm_bindgen_test - Examples — the demo app, vanilla example, bot, and full-stack integration
License
telegram-webapp-sdk is licensed under the MIT license.