-
-
Notifications
You must be signed in to change notification settings - Fork 1
Installation en
github-actions[bot] edited this page Jul 8, 2026
·
1 revision
Add the crate to your Cargo.toml:
[dependencies]
telegram-webapp-sdk = "0.11"The crate ships with no default features (default = []), so you opt into
exactly what you need:
telegram-webapp-sdk = { version = "0.11", features = ["macros", "yew", "leptos", "mock"] }| Feature | Purpose |
|---|---|
macros |
telegram_app!, telegram_page!, and telegram_router! macros |
yew |
Yew context hook, reactive hooks, and system-button components |
leptos |
Leptos context provider, reactive hooks, and system-button components |
mock |
Configurable mock Telegram.WebApp for local development |
full |
Shortcut for macros + yew + leptos + mock
|
Typically you enable a single framework feature plus mock:
# Leptos app with local mock support
telegram-webapp-sdk = { version = "0.11", features = ["leptos", "mock"] }The MSRV is Rust 1.96 (edition 2024). Older toolchains are not supported.
rustup update stable
rustc --version # must be >= 1.96Telegram Mini Apps run as WebAssembly in the Telegram in-app browser, so you
build for the wasm32-unknown-unknown target:
rustup target add wasm32-unknown-unknownUse a WASM bundler to produce the final .wasm + JS glue and an index.html.
Trunk (recommended for whole apps — this is what the demo uses):
cargo install trunk
trunk serve # dev server with live reload
trunk build --releaseA minimal index.html for Trunk pulls in Telegram's script and your crate:
<!doctype html>
<html>
<head>
<script src="https://telegram.org/js/telegram-web-app.js"></script>
<link data-trunk rel="rust" />
</head>
<body></body>
</html>wasm-pack (for libraries or JS-driven integration):
cargo install wasm-pack
wasm-pack build --target web- Quick Start — initialize the SDK and show your first button
- Framework Integration — wire up Leptos or Yew
- Mock & Testing — run outside Telegram during development
Getting Started
Guide
Начало работы
Руководство