Inline mode is underused. Most bots ignore it. For a template-selection flow, it is the best UX Telegram offers.
How it works
When a user types @LiveAvaBot query in any chat, Telegram sends an inline_query to your bot. You respond with up to 50 results.
The aiogram 3 handler
from aiogram import Router
from aiogram.types import InlineQuery, InlineQueryResultCachedMpeg4Gif
router = Router()
TEMPLATES = [...] # list of (file_id, title) tuples
@router.inline_query()
async def handle_inline(query: InlineQuery):
q = query.query.lower().strip()
results = [
InlineQueryResultCachedMpeg4Gif(
id=str(i),
mpeg4_file_id=fid,
title=title,
)
for i, (fid, title) in enumerate(TEMPLATES)
if not q or q in title.lower()
]
await query.answer(results[:25], cache_time=300, is_personal=False)
Caching file_ids
Upload each template once via bot.send_animation, save the file_id. Never re-upload.
Try it: https://t.me/LiveAvaBot?start=devto_article_20260503
Top comments (0)