Instead of opening a separate mini app, Telegram 13.2 lets bots run HTML, CSS, and javascript directly inside chats. These interactive HTMLBubbles can respond to user and bot actions, bringing small games and other tools into the conversation itself.
HTMLBubbles can host animated mini-games, interactive polls, graphs, and calculators. Enthusiasts have already demonstrated message-based clones of Wolfenstein 3D, Geometry Dash, and 2048.
Widgets can change after a message has been sent: a bot can update its contents without resending or editing the message, for example to show current poll results. HTMLBubbles can also preserve their state between Telegram sessions, allowing a game to remember its progress.
There are limits to what widgets can do. Their HTML, CSS, and javascript code is capped at 32 KB, while each widget can be no larger than 600 × 600 pixels and cannot scroll. Direct network requests, external scripts and files, input fields, video, and WebGL are also prohibited.
Telegram is preparing Bot API 10.4 methods that will let bots send and update widgets, as well as synchronize data across multiple copies of a message. The Bot API documentation describes the new methods.
Telegram has also published the source code for the WidgetSandbox environment, the Twidget engine, and the QuickJS javascript engine. Will HTMLBubbles' restrictions make chat widgets safer, or limit the games and tools developers can create?
