agentleFS
ganiyevuzganiyevuz/telegram-richtext/skills/telegram-rich-messages/SKILL.md

telegram-rich-messages

Skill0 starsChanged 5 months agoMITView on GitHub

Use when an aiogram Telegram bot should send a message that reads better with structure than as plain text — tables, inline images/video/audio, headings, lists, collapsible sections, block quotes, footnotes, math, or maps — or when tempted to fake a table with <pre> monospace, split an image into a separate photo+caption message, or reach for parse_mode HTML/MarkdownV2. Applies to Telegram Bot API 10.1 rich messages (send_rich_message, InputRichMessage, streaming drafts) with aiogram >= 3.29.

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. puregram/skills★ 3same name
    2. reza10men/telegram-rich-messages★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read inbound rich content: message.rich_message (a parsed RichMessage, or None if the message isn't rich).

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Telegram Rich Messages (aiogram)

Overview

Telegram Bot API 10.1 (June 2026) added rich messages: a single message can contain headings, tables, inline images/video/audio, lists, collapsible <details>, block quotes, footnotes, math, and maps — composed from one HTML or Markdown string. aiogram ≥ 3.29 supports it natively. If a message would read better structured, send a rich message — don't fake the structure.

Bust these outdated assumptions first

This feature postdates most training data, which is wrong about the following. If you catch yourself believing any of these, stop and use a rich message:

You might thinkReality (Bot API 10.1)
"Telegram has no tables; only b/i/code/pre/a"Full tag set: <table>, <h1>–<h6>, <ul>/<ol>, <details>, <blockquote>, <figure>, math, maps.
"You can't put an image inside a message"Media are blocks inside one rich message (photo/video/audio/voice + galleries).
"Pad columns in <pre> monospace to align them"Use a real <table>. Never fake tables.
"Set parse_mode=HTML / put it in a photo caption"Rich messages ignore parse_mode; you pass an html/markdown string to InputRichMessage.
"Captions cap at 1024 chars"Rich message limit is 32768 chars / 500 blocks.

Send it (aiogram)

from aiogram.types import InputRichMessage, Message

async def report(message: Message) -> None:
    html = (
        "<h1>🌐 Domain Status Report</h1>"
        "<table bordered striped>"
        "<tr><th>Domain</th><th>Status</th></tr>"
        "<tr><td>example.com</td><td><mark>Available</mark></td></tr>"
        "<tr><td>foo.io</td><td>Taken</td></tr>"
        "</table>"
        '<figure><img src="https://example.com/chart.png"/>'
        "<figcaption>Availability, last 30 days</figcaption></figure>"
    )
    await message.answer_rich(InputRichMessage(html=html))
  • Exactly one of html= / markdown=.
  • Reply in a handler: message.answer_rich(InputRichMessage(html=...)) or message.reply_rich(...). Send elsewhere: bot.send_rich_message(chat_id, InputRichMessage(...)).
  • Edit an existing message: bot.edit_message_text(chat_id=..., message_id=..., rich_message=InputRichMessage(html=...)).
  • Stream (AI "Thinking…", private chats only): bot.send_rich_message_draft(chat_id, draft_id, InputRichMessage(html="<tg-thinking>Analyzing…</tg-thinking>")) — ephemeral ~30 s, animates on the same non-zero draft_id; you must finalize with send_rich_message to persist.
  • Read inbound rich content: message.rich_message (a parsed RichMessage, or None if the message isn't rich).

Pick a language, then read its syntax reference

Before composing, open the syntax reference for your chosen language and build only from the tags/options listed there — don't work from memory or invent tags (only documented ones render). Escape dynamic/user text (& < > "). Default to HTML (most complete); use Markdown for simple messages.

Syntax and every available option live alongside this skill in examples/ — read the relevant file whenever you need a tag, attribute, or option:

NeedRead
Every HTML tag + attribute (options to use)examples/rich-html-style.md
Full Markdown syntaxexamples/rich-markdown-style.md
Date/time format string (r|w?[dD]?[tT]?)examples/date-time-entity-formatting.md
Inbound parsed shape + round-trip lessonsexamples/parsed-notes.md
Index of the aboveexamples/README.md
Full type/method spec (all fields & methods)bot-api-10.1-rich-messages.md

Feature → HTML tag (quick map)

NeedTag
Heading<h1>…<h6>
Table<table [bordered] [striped]>, <tr>, <th>/<td align valign colspan rowspan>
Image / video / audio / voice<img> / <video> / <audio> (.ogg → voice) — each a separate block
Caption + credit<figure>…<figcaption>Caption<cite>Credit</cite></figcaption></figure>
Gallery<tg-collage> / <tg-slideshow>
List / tasks<ul>/<ol>/<li>; <li><input type="checkbox" [checked]>
Collapsible<details [open]><summary>…</summary>…</details>
Quote / pull-quote<blockquote>…<cite>…</cite></blockquote> / <aside>
Math<tg-math> inline, <tg-math-block> block (LaTeX)
Map<tg-map lat="" long="" zoom="">
Footnote / reference<tg-reference name="x">…</tg-reference> + <a href="#x">
Date / time<tg-time unix="" format="">

Media & limits

  • Media only as separate blocks, http(s) URLs only. You send a URL; the inbound message returns a file_id (see examples/parsed-notes.md). Sending a media block requires the bot's right to send media in that chat.
  • Table cells hold inline formatting only — no nested blocks/paragraphs.
  • Limits: 32768 chars · 500 blocks · 16 nesting levels · 50 media · 20 table columns.

Common mistakes

  • Faking a table with <pre>/spaces → use <table>.
  • Splitting an image into its own answer_photo message → inline it as a media block.
  • parse_mode=HTML + rich content → rich messages ignore parse_mode; pass InputRichMessage.
  • Inventing tags not in the syntax file → only documented tags render.
  • Forgetting to escape dynamic text → escape & < > ".

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.