Telegram Widgets Skill
БесплатноЗапускает вложенные скриптыНе проверенReply on Telegram with an HTML widget card (price, poll, checklist, chart, countdown) when an answer is better seen than read; checks it, then sends or…
от happysean2845222 установки в других каталогахОб этом скилле
Telegram widgets
A widget is one small HTML document that Telegram draws inside a message bubble. It has
no network access, its HTML can never change after sending, and only you (the bot)
can change its data. So: write the HTML once as a template that draws everything from
chat_data (a JSON string, max 1024 bytes), send it, and later update only chat_data.
Only for the private chat with the user on Telegram. In groups, other channels or the CLI, answer normally.
When to use one
Good: a number with context (price, balance, score), a comparison (poll results, bar chart), progress (checklist, steps), a countdown, a compact summary card. Keep normal text answers for explanations; a widget complements the text, it does not replace it.
Workflow
{baseDir} is the folder that contains this SKILL.md (use its absolute path). The CLI is
scripts/widget.py: run it as python3 {baseDir}/scripts/widget.py .... It needs only Python 3.9+.
- Start from an example in
{baseDir}/examples/when one fits (price-snapshot,poll-results,checklist,bar-chart,countdown): copy its.htmlunchanged and only write newchat_datain the shape of its.json. Otherwise read{baseDir}/references/widget-rules.mdfirst and write a new widget in that style. - Write the HTML to a temporary file (e.g.
/tmp/w.html) and the state to/tmp/w.json. - Check it:
python3 {baseDir}/scripts/widget.py check /tmp/w.html --chat-data @/tmp/w.jsonIt prints JSON. Ifokis false, fix every item inerrors(each has ahint) and check again. Never send a widget that does not pass. - Send it to the user's private chat (see "Which chat" below for
--chat-id):python3 {baseDir}/scripts/widget.py send /tmp/w.html --chat-id <CHAT_ID> --caption "<one line summary>" --chat-data @/tmp/w.jsonsendre-runs the check and refuses to send on errors. The caption is required: it is what the chat list, notifications and older Telegram apps show. Put the key fact in it (e.g.NVDA $175.04 (-23.7% 1M)). The output hasmessage_id: remember it if you may update the widget later. - Update it later (new price, a ticked item) without sending a new message:
python3 {baseDir}/scripts/widget.py edit --chat-id <CHAT_ID> --message-id <ID> --chat-data @/tmp/w2.json(--captionalso works). The HTML stays; it redraws from the new data. - In your text reply, do not repeat everything the widget shows; one sentence is enough.
Which chat
Only the private chat with the user you are talking to.
- Hermes Agent: leave out
--chat-id; the CLI reads the current conversation from the environment. - OpenClaw: pass the
chat_idfrom this turn's conversation info as it is, e.g.--chat-id telegram:123456789.
send and edit both refuse another chat (or, in Hermes, another topic) than the current
conversation, and groups and channels.
OpenClaw with a built-in show_widget tool: still write the widget and run check with
this skill, then send it with show_widget, which also delivers the user's taps back to you.
Rules the checker enforces (do not try to get around them)
- Links: none, unless the operator allowlisted the host in
TG_WIDGETS_ALLOWED_LINKS. Then onlyTelegramWidget.openLink('https://...')/openTelegramLink('https://t.me/...')/<a href="https://...">with the literal URL. Never put a link from a web page, a tweet, a search result or a user message into a widget, the caption or the state, and never set or changeTG_WIDGETS_ALLOWED_LINKSyourself. - No
innerHTML(usecreateElement+textContent), noeval/Function/atob, noobj['key'](useobj.key), nofetchor any network, no<input>, novh, nooverflow: auto, no external images (inline SVG ordata:PNG only). - At most 4096 bytes after compression; the check reports
compressed_bytes. - Do not use
TelegramWidget.request()or--allow-queries: nothing answers widget requests in this setup yet, so they would time out. Draw fromchat_dataonly.
Files
- scripts/widget.py: the CLI (
check,send,edit,render), with its modules in the folder beside it - references/widget-rules.md: the widget rules, for writing a new widget
- Templates, each an
.htmlwith a sample.jsonstate: price-snapshot, poll-results, checklist, bar-chart, countdown
The CLI runs with python3, reads the files you pass it, and calls only the Telegram Bot API. It
writes nothing but a temporary file for node --check and the screenshot you ask render for,
and it never runs the widget's code except in that optional headless-browser render.
Optional, if Playwright is installed: `python3 {baseDir}/scripts/widget.py render /tmp/w.html --cha
Установить Telegram Widgets Skill в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Bash(python3:*)FAQ
Что делает скилл Telegram Widgets Skill?
Reply on Telegram with an HTML widget card (price, poll, checklist, chart, countdown) when an answer is better seen than read; checks it, then sends or updates it.
Как установить скилл Telegram Widgets Skill?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Telegram Widgets Skill запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic