Your own HTML — as a widget that works on every client.
Packer
Target: 3950 bytes after zlib
We measure like the Telegram server: zlib 9. The send limit is 4 KB compressed and 32 KB uncompressed.
Stages
We cut what the engine drops, comments and whitespace, minify CSS, JS through terser, shorten ids and classes. A stage stays only if the result got smaller.
If it still doesn’t fit
Large data moves to public_data, and the code reads it through TelegramWidget.publicData. No eval.
Checked for engines
A linter for JavaScriptCore on iPhone, Nova on Mac and Android, and a run in a QuickJS sandbox before sending.
Today the packer works in the studio: paste HTML, get a file that will pass.
API — coming soon
Ready HTML for your bot
GET /v1/widgets/<name>?data=… — we return HTML, your bot sends it with sendWidget.
Send by key
POST /v1/widgets/<name>/send {chat_id, data} — one line in your code.
Widget data
Change a widget’s data with a webhook — it updates in the chat without resending.
The address, keys and SDK will be published at launch. Need it sooner? Message @widgetsai.