Quickstart
Create a bot, find your chat ID, and send your first message.
Send messages
Text, inline keyboards, contacts, locations, and chat actions.
Read updates
Poll Telegram and work with parsed message data.
Download files
Save attachments to disk or keep them in memory.
What it covers
- Long polling with server-side long polling and configurable failure retries
- Parsed
Messageobjects alongside the untouched Telegram payload - Text, contact, location, photo, video, audio, voice, document, sticker, animation, and video note messages
- Media groups from lists, including automatic chunking above Telegram’s 10-item limit
- Files from disk, URLs, Telegram file IDs, in-memory bytes, and open file objects
- Inline keyboards, callback answers, chat actions, and message edits
- Forwarding, copying, deleting, pinning, and unpinning messages
- Downloads to disk or memory with custom names
- Webhooks and bot, chat, and file information
- Typed exceptions for API, network, and timeout failures
Requirements
- Python 3.10 or newer
requests
Message object. Media-group sends return a list of Message objects. copy_message returns a dictionary containing the new message_id, and methods that only confirm success return Telegram’s raw result, usually True.