skillfed

Telethon

Full-featured Telegram client library for Python 3

telethon v1.44.0 3.7M downloads/30d#2,515 on PyPI
Permissive license MIT Active released

What it is and what it does

Telethon wraps Telegram's MTProto protocol in a Python 3 asyncio library, letting you write programs that send messages, download media, handle events, and automate interactions with Telegram accounts or bots. It handles the cryptographic and protocol complexity so you can focus on application logic rather than low-level API details.

The library supports both user accounts and bot accounts, offering an alternative to Telegram's official bot API when you need user-level access or more direct control. It requires obtaining API credentials from Telegram's developer portal and respects Python 3.5 and later. The two core dependencies (pyaes for encryption and rsa for key handling) are lightweight, keeping installation straightforward.

Use it for:

  • Automate sending messages or files to Telegram contacts or groups from a Python script.
  • Build a bot that listens for incoming messages and responds to patterns or commands.
  • Download and archive media from Telegram conversations programmatically.
  • Monitor a Telegram channel or group and trigger actions based on new messages.
  • Migrate data or integrate Telegram messaging into a larger application workflow.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Telethon is an asyncio-based Python library that implements the MTProto protocol to interact with Telegram's API as a user account or bot, providing an alternative to Telegram's official bot API.

Yes, if you need to interact with Telegram from Python and can obtain API credentials. The library is actively maintained, has low install friction, carries no known vulnerabilities, and is MIT-licensed. Be aware that Telegram's ToS prohibit certain uses and account bans are possible—read the documentation's compatibility and FAQ sections before deploying to a production account.

Install

telethon on PyPI

pip

pip install telethon

uv

uv add telethon

poetry

poetry add telethon

Installing Telethon

Before you install

Low install friction with only two runtime dependencies (pyaes, rsa). Maintenance status is active with a release within the last 60 days. The library is in maintenance mode for v1, accepting bug fixes and layer updates.

License in practice

MIT license permits commercial and private use, modification, and distribution with minimal restrictions—suitable for most projects.

Quickstart

pip install telethon

from telethon import TelegramClient, events

api_id = 12345
api_hash = '0123456789abcdef0123456789abcdef'
client = TelegramClient('session_name', api_id, api_hash)
client.start()
client.send_message('username', 'Hello from Telethon')

You must obtain api_id and api_hash from https://my.telegram.org under API Development before the client can connect.

Verify before relying

  • Whether account bans or limitations occur in practice when using the library, despite ToS warnings in the documentation.
  • Current compatibility with the latest Telegram protocol changes beyond what the release date suggests.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.5)
Install friction low — pure-Python wheel
Runtime dependencies 2 — pyaes, rsa
Maintenance actively maintained — 60 days since the last release
First released
Downloads 3,727,765/month — #2,515 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: telethon-1.44.0-py3-none-any.whl

Keywords: api, chat, client, library, messaging, mtproto, telegram

Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Topic :: Communications :: Chat

Tags

telegram client library pythonmtproto telegram api wrappertelegram bot alternativetelegram user account automationasyncio telegram messagingtelegram api python 3telegram message sending library
telegram-apimtprotoasync-messaging

More Chat packages