Rich Messages#
Rich messages (also called article messages) are structured content messages introduced in Bot API 10.1. They support styled text, photos, videos, tables, slideshows, and more — similar to Telegram’s Instant View format.
Sending a Rich Message#
from ftmgram import Client
from ftmgram.types import (
InputRichMessage,
InputRichMessageContent,
RichText,
)
app = Client("my_bot", bot_token="TOKEN")
async def main():
async with app:
await app.send_rich_message(
chat_id=123456789,
rich_message=InputRichMessage(
title=RichText.plain("My Article Title"),
content=[
InputRichMessageContent.paragraph(
text=RichText.concat([
RichText.bold("FTMGram"),
RichText.plain(" is the most up-to-date MTProto library."),
])
),
]
)
)
app.run(main())
RichText Types#
Type |
Description |
|---|---|
|
Plain text |
|
Bold text |
|
Italic text |
|
Underlined text |
|
~~Strikethrough~~ text |
|
Inline |
|
Hyperlink |
|
Highlighted/marked text |
|
Combine multiple RichText objects |
|
Clickable email address |
|
Clickable phone number |
|
Subscript text |
|
Superscript text |
RichBlock Types#
Block |
Description |
|---|---|
|
A paragraph of styled text |
|
An inline photo |
|
An inline video |
|
An audio player block |
|
A voice note block |
|
A GIF/animation block |
|
A data table |
|
Ordered or unordered list |
|
Multi-image slideshow |
|
Photo collage |
|
Block quote |
|
Code/preformatted block |
|
Section heading |
|
Horizontal divider |
|
Footer text |
|
Embedded map |
|
Collapsible details section |
|
LaTeX math expression |
|
AI thinking block |
Editing a Rich Message#
await app.edit_message_text(
chat_id=123456789,
message_id=42,
rich_message=InputRichMessage(
title=RichText.plain("Updated Title"),
)
)
Saving as Draft#
await app.send_rich_message_draft(
chat_id=123456789,
rich_message=InputRichMessage(
title=RichText.plain("Draft Article"),
)
)