Λογότυπο Tg Widgets

Tg Widgets

Κοινότητα
serejaris
tg-widgets

Use when building or sending a Telegram message widget (HTML bubble, HTMLBubbles, `sendWidget`, `messageMediaWidget`, Bot API 10.4): an interactive HTML, CSS and JS program inside a chat bubble, such as a game, poll, calculator or live ticker. Teaches everything needed to write one: size, bubble, input, sandbox rules, state and requests, sending, and where live delivery differs from the documentation. Not for Mini Apps or Rich Messages.

Επισκόπηση

Εκδότηςserejaris
Αποθετήριοtelegram-skills
Όνομα δεξιότηταςtg-widgets
Αστέρια
35
Διακλαδώσεις
4
Συνοδευτικά αρχεία
6
Άδεια χρήσηςMIT
Σύνδεσμοι
  • Οδηγίες σε Markdown

    Ένα αρχείο SKILL.md που το μοντέλο φορτώνει όταν χρειάζεται, ώστε να καταναλώνει token μόνο όταν ένα αίτημα είναι πράγματι σχετικό.

  • Λειτουργεί με οποιοδήποτε LLM

    Οι δεξιότητες AI είναι απλό Markdown, όχι κώδικας για συγκεκριμένο πάροχο, επομένως αυτή η δεξιότητα λειτουργεί με GPT, Claude, Gemini, Grok ή ένα τοπικό μοντέλο.

  • Συνοδευτικά αρχεία: 6

    Αρχεία script, πρότυπα και υλικό αναφοράς που μπορεί να διαβάζει το μοντέλο καθώς εργάζεται. Τα αρχεία είναι μόνο για ανάγνωση και δεν εκτελούνται ποτέ.

  • Ανοιχτού κώδικα

    Δημοσιεύτηκε στο GitHub από τον λογαριασμό serejaris. Ελέγξτε τα αρχεία της δεξιότητας στο αποθετήριο πριν την εγκαταστήσετε.

Εγκατάσταση

Εγκαταστήστε τη δεξιότητα AI Tg Widgets στο TypingMind για να τη χρησιμοποιείτε με οποιοδήποτε LLM ή προσθέστε τη σε άλλον πράκτορα AI που διαβάζει αρχεία SKILL.md.

1

Εγκατάσταση στο TypingMind

Το TypingMind εγκαθιστά μια δεξιότητα απευθείας από τον φάκελό της στο GitHub — διαβάζει το SKILL.md, συγκεντρώνει τα συνοδευτικά αρχεία σε πακέτο και αποθηκεύει το αποτέλεσμα τοπικά.

  1. Ανοίξτε την εφαρμογή και μεταβείτε στα Πρόσθετα → Δεξιότητες.
  2. Επιλέξτε «Εγκατάσταση από GitHub».
  3. Επικολλήστε το παρακάτω URL του φακέλου της δεξιότητας και επιβεβαιώστε.
    https://github.com/serejaris/telegram-skills/tree/main/skills/tg-widgets
  4. Ενεργοποιήστε τη δεξιότητα σε κάθε συνομιλία όπου θέλετε να είναι διαθέσιμη.
Πρόσθετα → Δεξιότητες → Προσθήκη δεξιότητας → Από URL του GitHub, έπειτα επικολλήστε το URL του φακέλου και πατήστε «Συνέχεια».
2

Εγκατάσταση σε άλλον πράκτορα AI

Κάθε πράκτορας AI που υποστηρίζει τη μορφή Agent Skills μπορεί να χρησιμοποιήσει αυτή τη δεξιότητα — αντιγράψτε τον φάκελο στον κατάλογο δεξιοτήτων του.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/serejaris/telegram-skills.git /tmp/telegram-skills
mkdir -p .claude/skills
cp -r /tmp/telegram-skills/skills/tg-widgets .claude/skills/tg-widgets
Επανεκκινήστε το Claude Code μετά την αντιγραφή, ώστε να εντοπίσει τη νέα δεξιότητα.

Χρησιμοποιήστε τη στο TypingMind

Ενεργοποιήστε τη δεξιότητα Tg Widgets σε οποιαδήποτε συνομιλία στο TypingMind και το μοντέλο αναλαμβάνει τα υπόλοιπα. Το όνομα και η περιγραφή της περιλαμβάνονται στην προτροπή συστήματος και, μόλις προκύψει ένα σχετικό αίτημα, το μοντέλο φορτώνει μόνο του τις πλήρεις οδηγίες — δεν χρειάζεται ποτέ να την καλείτε χειροκίνητα και δεν καταναλώνει token μέχρι να χρησιμοποιηθεί πραγματικά.

Το μοντέλο φορτώνει αυτόματα τη δεξιότητα Tg Widgets μόλις λάβει ένα σχετικό αίτημα.

Λειτουργεί με οποιοδήποτε μοντέλο AI

Οι δεξιότητες AI είναι οδηγίες σε απλό κείμενο Markdown και όχι κώδικας για συγκεκριμένο πάροχο, οπότε η δεξιότητα Tg Widgets δεν περιορίζεται στο μοντέλο για το οποίο γράφτηκε. Εγκαταστήστε τη μία φορά στο TypingMind και χρησιμοποιήστε τη με GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ή ένα τοπικό μοντέλο που εκτελείτε εσείς — πάντα με τα δικά σας κλειδιά API.

  • Φόρτωση μόνο όταν χρειάζεται

    Η προτροπή συστήματος περιλαμβάνει μόνο το όνομα και την περιγραφή. Οι οδηγίες ανακτώνται με το πρώτο σχετικό αίτημα, οπότε μια δεξιότητα που δεν χρησιμοποιείται δεν έχει κόστος.

  • Αλλάξτε μοντέλο κατά τη διάρκεια της συνομιλίας

    Επειδή η δεξιότητα αποτελείται από οδηγίες και όχι από κώδικα, η αλλαγή μοντέλου δεν επηρεάζει τη λειτουργία της — το επόμενο μοντέλο διαβάζει το ίδιο αρχείο SKILL.md.

Οδηγίες δεξιότητας

Αυτό είναι το περιεχόμενο του αρχείου SKILL.md που φορτώνει το μοντέλο. Διαβάστε το πριν από την εγκατάσταση — μια δεξιότητα αποτελείται από οδηγίες που θα ακολουθήσει το μοντέλο σας.

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. Telegram has not announced widgets, the public Bot API docs stop at 10.3, and names may change until 10.4 ships. For a detail not covered here, see docs/sdk-v1.md and docs/profile-v1.md in that repository.

Steps

  1. Write the widget by the rules below.

  2. Measure as the server does:

    bash
    python3 scripts/widget_tool.py check widget.html
  3. 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.

    bash
    TELEGRAM_BOT_TOKEN=... python3 scripts/widget_tool.py send widget.html --chat CHAT_ID --caption "Tap the water to feed"
  4. Open it on a phone. A successful sendWidget proves only that the server accepted it: clients below layer 233 show an unsupported-media stub with the caption, so write a caption that makes sense alone.

Size

The server compresses the HTML with zlib level 9 and refuses anything over 4096 bytes, or over 32768 bytes raw, with INPUT_MEDIA_WIDGET_TOO_LARGE. Aim for 3800 if you cannot measure.

  • Repeated CSS and markup compress well. data: images and long unique text do not.
  • Non-ASCII text compresses badly: cutting Russian strings saved more than renaming identifiers.
  • Generate scenes in code instead of storing them.
  • No comments, no dead code. Minify with terser.

Bubble

  • 200–600 px wide, phones about 320–430: design for 320. Up to 600 px tall; the rest is clipped and nothing scrolls inside. Split long content into pages or tabs.
  • width and height in sendWidget set the size, 0 means auto. Lay out with %, flex, grid or vw, never vh.
  • html has no background: the bubble's colour shows through, and a background on html or body paints the whole bubble. body has a margin of about 8px 12px; body{margin:0} goes edge to edge.
  • Colours: --tg-theme-bg-color, --tg-theme-text-color, --tg-theme-hint-color, --tg-theme-link-color, --tg-theme-button-color, --tg-theme-button-text-color, --tg-theme-secondary-bg-color; --tg-color-scheme is light or dark. Build on them so both themes work, or paint the whole bubble yourself.
  • Without a caption below, the client draws the message time over the bottom corner. Keep env(safe-area-inset-bottom) clear, and set body{padding:0} if you pad for it yourself.
  • Text is not selectable unless you set user-select:text and -webkit-user-select:text.

Input

Taps (click) and pointer events only. No touch events, keyboard, focus, text input, wheel or scroll events. A double tap is always the widget's.

Vertical drags belong to the chat, whatever touch-action says. So no vertical sliders, wheel pickers or free drawing: use horizontal controls or buttons.

touch-action on the elementUse forHoldHorizontal drag
auto (default)everything elsechat's message menuchat's swipe-to-reply
pan-yslider, carousel, paddlechat's menuwidget's
nonecanvas, game control, held buttonwidget'swidget's

The first move past 10 px decides the whole press: a drag that starts sideways on a claimed element stays with the widget on both axes, and one that starts up or down goes to the chat, and the widget gets pointercancel and no click. On pointercancel, undo what pointerdown started. The leading 20 px never take a claim because of the system back gesture: keep controls away from that edge.

What works

  • HTML: text elements, lists, tables, details, a, button (unstyled, it looks like the client's own), canvas, img with data: PNG, JPEG, GIF or WebP up to 1024×1024, inline SVG with shapes, paths, text, use and gradients.
  • CSS: flex, grid, positioning, shadows, gradients, 2D transforms, opacity, filter and backdrop-filter with blur(), brightness() and drop-shadow() only, transitions, @keyframes, custom properties, calc, @media on width, prefers-color-scheme, @supports. Fonts: system-ui, sans-serif, serif, monospace, ui-* only.
  • JS: ES2023 in an interpreter without JIT, timers, requestAnimationFrame, the DOM, canvas 2D (paths, arcs, fillText, gradients, setTransform, clip, drawImage), el.animate, Intl, crypto.getRandomValues, localStorage, sessionStorage. Use document.getElementById('x'): ids are not global variables.

Not available

Removed silently while the rest keeps running, so a removed feature is a bug you will not see.

  • Network: fetch, XMLHttpRequest, WebSocket throw NetworkDisabledError; nothing external loads.
  • Canvas: WebGL, OffscreenCanvas, getImageData, putImageData, createImageData, toDataURL, shadowBlur, globalCompositeOperation, ctx.filter, createPattern from a canvas.
  • CSS: 3D transforms, perspective, vh, overflow:auto|scroll, position:sticky, text-shadow, clip-path, mask, mix-blend-mode, background-clip:text, color-mix, oklch, @font-face, named fonts, @container, :has, CSS nesting.
  • HTML: form controls, audio, video, iframe, dialog, progress.
  • JS: libraries, Worker, alert, confirm, navigator.clipboard, window.open, location changes, Blob, customElements.

TelegramWidget

window.TelegramWidget is undefined outside Telegram, so guard it.

MemberPurpose
ready()optional, first state drawn
colorScheme, themeParams, onEvent('themeChanged', fn)theme
HapticFeedback.impactOccurred('light'), .notificationOccurred('success'), .selectionChanged()haptics: free during a touch and 5 s after it, otherwise one short series per 10 s
openLink(url), openTelegramLink(url), copyText(text), request(data)need a real tap: call in a click handler, one per tap, not after await or a timer
chatData, publicData, onEvent('chatDataChanged', fn), onEvent('publicDataChanged', fn)state written by the bot, up to 1024 bytes of text or null
watchPublicData()poll the shared state live while on screen
viewer, isForward, chatType, isPreviewwho looks and where; viewer is null where the widget may not ask the bot
walletGram Wallet; null where unavailable. See docs/sdk-v1.md §2.18

State and requests

  • chatData belongs to this message in its chat: a game in progress, whose turn it is. A forward never gets it.
  • publicData is seen wherever the widget is shown: poll results, a price. A forward gets a frozen copy, or the live value if the bot sent the widget with is_shared.
  • localStorage is this user's own, per message and device, 4 KB; catch QuotaExceededError. Use it for a best score or a seed.
  • request(data) works like a callback button: 1–64 bytes, resolves with {result} up to 1024 bytes, rejects with error.code: NOT_ALLOWED, BUSY, RATE_LIMITED, TIMEOUT, FAILED, INVALID_ANSWER. It needs allow_queries at sending. The answer does not change the state: have the bot edit it, or return the new state in result.

Lifecycle and limits

The widget can be destroyed and recreated at any time: restore from localStorage and the state, and draw the first frame synchronously. Off screen there are no animation frames and timers fire at most once per second.

LimitValue
CPU300 ms per second; one task up to 500 ms, longer stops the widget
Memory, nodes8 MB, 2000 nodes
Canvas4000 commands per canvas per task, 2048×2048 pixels in total
Paint16 elements with blurred shadow, filter or opacity below 1; 2 with backdrop-filter. Mute with colour instead of opacity
Layout reads128 per task; cache them and never read every frame
Other64 timers, 400 CSS rules, 32 @keyframes, 64 script animations

Past a limit the widget stops on its last frame with a "Widget stopped" badge.

Skeleton

html
<style>body{margin:0}canvas{display:block;width:100%;touch-action:none;image-rendering:pixelated}</style>
<canvas id="c"></canvas>
<script>
const T=window.TelegramWidget,c=document.getElementById('c'),x=c.getContext('2d');
const W=c.clientWidth||360,H=Math.round(W*9/16),S=3;
c.style.height=H+'px';c.width=W/S|0;c.height=H/S|0;
let last=0;
function frame(t){requestAnimationFrame(frame);if(t-last<33)return;last=t;
  x.fillStyle='#024';x.fillRect(0,0,c.width,c.height)}
c.addEventListener('click',e=>{const r=c.getBoundingClientRect();
  T&&T.HapticFeedback.selectionChanged()});
requestAnimationFrame(frame);T&&T.ready();
</script>

Delivery: documentation and live check

The documentation allows more than the live API accepted. Live means real requests on 2026-11-06 with production bots. Recheck before you plan around it.

TargetDocumentationLive
api.telegram.org/bot<token>/sendWidgetbeta path only404
api.telegram.org/beta/bot<token>/sendWidgetworksworks with a normal token
Private chat with the botallowedworks, rendered on an iPhone
Group or supergroup with the botallowedsupergroup and a channel's discussion group refused: INPUT_MEDIA_WIDGET_NOT_ALLOWED
Channel, directnot allowed yetrefused, same error
Inline modeallowedrefused in a channel, and for a query from the private chat with the bot
forwardMessageallowed to any chatrefused: the message can't be forwarded
copyMessagerefusedrefused

To put a widget in front of a channel audience today, publish a post with a video and a t.me/<bot>?start=... link, and let the bot send the widget in the private chat.

Bot API

MethodPurpose
sendWidgetchat_id, html, width, height (0 = auto), chat_data, public_data, caption, allow_queries, is_shared, reply_markup
sendSharedWidgetpost an existing shared widget again by widget_id
editMessageWidgetDatachange chat_data or public_data of one message silently; message is not modified counts as done
editSharedWidgetDatachange the state of a shared widget everywhere, cache_time 5–3600 s
answerWidgetQueryanswer the widget_query or shared_widget_query update, always, or the widget gets TIMEOUT

Examples

examples/ holds widgets built with this skill and opened on an iPhone. They show one author's look. Sizes after zlib level 9:

Συνοδευτικά αρχεία

Το μοντέλο τα διαβάζει όποτε χρειάζεται, όσο η δεξιότητα είναι φορτωμένη. Διατίθενται ως αρχεία για ανάγνωση και δεν εκτελούνται ποτέ.

Συχνές ερωτήσεις

Τι κάνει η δεξιότητα AI Tg Widgets;

Use when building or sending a Telegram message widget (HTML bubble, HTMLBubbles, `sendWidget`, `messageMediaWidget`, Bot API 10.4): an interactive HTML, CSS and JS program inside a chat bubble, such as a game, poll, calculator or live ticker. Teaches everything needed to write one: size, bubble, input, sandbox rules, state and requests, sending, and where live delivery differs from the documentation. Not for Mini Apps or Rich Messages.

Γιατί να χρησιμοποιήσετε τη δεξιότητα Tg Widgets στο TypingMind;

Επειδή την εγκαθιστάτε μία φορά και τη χρησιμοποιείτε με οποιοδήποτε μοντέλο. Η Tg Widgets είναι απλό Markdown και όχι κώδικας ειδικά για κάποιον πάροχο, επομένως η ίδια δεξιότητα λειτουργεί με GPT-5, Claude, Gemini, Grok ή ένα τοπικό μοντέλο — και μπορείτε να αλλάξετε μοντέλο κατά τη διάρκεια της συνομιλίας χωρίς να διακοπεί η λειτουργία της. Το TypingMind λειτουργεί με τα δικά σας κλειδιά API, οπότε πληρώνετε απευθείας τους παρόχους αντί για συνδρομή ανά θέση χρήστη, ενώ οι δεξιότητες και οι συνομιλίες σας παραμένουν στον δικό σας χώρο αποθήκευσης.

Πώς εγκαθιστώ τη δεξιότητα Tg Widgets στο TypingMind;

Στο TypingMind, ανοίξτε Πρόσθετα → Δεξιότητες → Εγκατάσταση από το GitHub και επικολλήστε τη διεύθυνση https://github.com/serejaris/telegram-skills/tree/main/skills/tg-widgets. Το TypingMind διαβάζει το αρχείο SKILL.md, συγκεντρώνει τα συνοδευτικά αρχεία και εγκαθιστά τη δεξιότητα, την οποία μπορείτε να ενεργοποιείτε ανά συνομιλία.

Ποια μοντέλα AI μπορούν να χρησιμοποιήσουν τη δεξιότητα Tg Widgets;

Οποιοδήποτε μοντέλο συνδέετε στο TypingMind. Οι δεξιότητες AI είναι απλές οδηγίες Markdown και όχι κώδικας ειδικά για κάποιον πάροχο, επομένως τα GPT, Claude, Gemini, Grok και τα τοπικά μοντέλα μπορούν όλα να φορτώσουν αυτή τη δεξιότητα όταν ένα αίτημα αντιστοιχεί σε αυτή.

Με πόσα μοντέλα AI μπορώ να χρησιμοποιήσω τη δεξιότητα Tg Widgets;

Με όσα θέλετε. Στο TypingMind μπορείτε να χρησιμοποιήσετε τη δεξιότητα Tg Widgets με οποιοδήποτε μοντέλο υποστηρίζει δεξιότητες, όπως τα GPT, Claude, Gemini, Grok, DeepSeek, Mistral και Llama, χρησιμοποιώντας τα δικά σας κλειδιά API.

Είναι δωρεάν η δεξιότητα AI Tg Widgets;

Ναι. Δημοσιεύεται στο GitHub από τον λογαριασμό serejaris με την άδεια χρήσης MIT. Πληρώνετε μόνο τον δικό σας πάροχο AI για τα token που χρησιμοποιείτε.

Τι είναι οι δεξιότητες AI;

Μια δεξιότητα AI είναι ένα επαναχρησιμοποιήσιμο πακέτο οδηγιών που διδάσκει σε ένα μοντέλο AI πώς να εκτελεί μια συγκεκριμένη εργασία. Ακολουθεί την ανοιχτή μορφή Agent Skills: ένα αρχείο SKILL.md με όνομα και περιγραφή, μαζί με τυχόν σενάρια κώδικα, πρότυπα ή αρχεία αναφοράς που μπορεί να χρειαστεί το μοντέλο. Το μοντέλο διαβάζει τις οδηγίες μόνο όταν το αίτημά σας αντιστοιχεί στη δεξιότητα, οπότε μια εγκατεστημένη δεξιότητα δεν κοστίζει τίποτα μέχρι να χρησιμοποιηθεί.

Σε τι διαφέρουν οι δεξιότητες AI από τα πρόσθετα ή τους συνδέσμους MCP;

Ένα πρόσθετο ή ένας σύνδεσμος MCP παρέχει στο μοντέλο νέα εργαλεία που μπορεί να καλέσει — κώδικα που εκτελείται κάπου και επιστρέφει ένα αποτέλεσμα. Μια δεξιότητα AI παρέχει αντί γι’ αυτό γνώσεις και διαδικασίες στο μοντέλο: πώς να προσεγγίσει μια εργασία, ποια βήματα να ακολουθήσει και ποια χαρακτηριστικά έχει ένα καλό αποτέλεσμα. Οι δεξιότητες είναι απλό Markdown, επομένως δεν χρειάζονται διακομιστή, κλειδί API ή περιβάλλον εκτέλεσης και λειτουργούν με οποιοδήποτε μοντέλο.

Προβολή όλων

Δημιουργήστε τώρα τον δικό σας χώρο εργασίας AI

Εγγραφείτε στο ενημερωτικό μας δελτίο για να ενημερώνεστε για νέες λειτουργίες και μελλοντικές κληρώσεις δώρων 👇