tg-widgets
tg-widgets
A widget is one self-contained HTML document with inline CSS and JS. A bot sends it as a message, and it runs in the chat bubble with no window, no server and no network. The HTML never changes after sending; only the bot changes the widget's state.
Everything needed to write a widget is below. The rules follow Telegram's widget-sandbox documentation, v0.6.0, checked on 2026-11-06. Bot API 10.4 (2026-11-09) made widgets official: the methods and the delivery rules are on core.telegram.org/bots/widgets, and where that page and the repository disagree, the page wins. For a detail not covered here, see docs/sdk-v1.md and docs/profile-v1.md in that repository.
Steps
-
Write the widget by the rules below.
-
Measure as the server does:
python3 scripts/widget_tool.py check widget.html -
Send it to your private chat with the bot. The tool sends once and never retries: after a timeout the message may already be delivered.