SOLUTION / AUTOMATION-BOTS

Pyrogram and Telethon Development

Blaron builds Python tools on Telegram's MTProto API with Telethon, and maintains existing Pyrogram code, for jobs the Bot API cannot do: automating your own accounts and channels, exporting your own data, researching public channels, and building custom clients. Each tool uses its own api_id, keeps its session encrypted, waits out every FLOOD_WAIT, and stays within Telegram's API Terms.

Best fit: Teams that run their own Telegram channels and accounts, researchers studying public channels, organizations archiving their own Telegram data, and owners of Pyrogram or Telethon code that needs care or migration.

MessageFormSchedule
ControllerValidateDecideAct
CRM updatedEmail sentHeld for a person
Triggers enter through approved channels, rules decide, and anything risky stops with a person.

What we design around your workflow

The Bot API covers most automation, but some jobs need what a Telegram app can do: act as a user account, read a channel's history, or export your own chats. Python's MTProto libraries make that possible, and they also make it easy to break Telegram's rules or lose an account. We take on user-account work only for accounts you own and purposes Telegram allows. We decline spam, mass invites, member scraping, and fake accounts.

Own-account automation

Tools for accounts and channels you own, such as cross-posting, archiving, and admin reports that a bot cannot produce.

Data exports

Exports of your own chats, channels, and media into files or a database you control, with a record of what was taken and when.

Public channel research

Collection of posts from public channels at a measured pace, without member lists or private chats.

Large file pipelines

Transfers beyond hosted Bot API limits, with chunked uploads, checksums, and retries that respect flood waits.

Library care

Upgrades, fixes, and migrations for existing Pyrogram and Telethon code, including moves off unmaintained libraries.

Use MTProto only where the Bot API stops

Bots and user accounts reach Telegram through different doors. The Bot API is a simple HTTPS interface with fixed limits: hosted bots upload files up to 50 MB and download up to 20 MB, and a self-hosted Bot API server raises uploads to 2000 MB. Bots also cannot fetch chat history: Telegram documents messages.getHistory as a method only users can call. MTProto, the protocol Telegram's own apps use, lets a client act as a user, read chats it belongs to, and export its own data. When a bot can do the job, we build a bot.

  • Bot first

    Answering users, posting, and moderating are simpler and safer with a bot token than with a user session.

  • A local server for bot files

    For large files in bot workflows, a self-hosted Bot API server often removes the need for a user client.

  • Takeout for your own data

    Telegram's takeout API exports an account's own data inside a session whose flags match exactly what the user chose to export.

Primary sources

Choose a maintained library before writing code

Library health matters here, because Telegram updates its API layers often and an abandoned client falls behind. Pyrogram's official repository was archived in December 2024 with a note that the project is no longer maintained or supported. Telethon is now developed on Codeberg, where v1 is described as mostly in maintenance mode while new API layers are still added, with a v1.45 release in September 2026. For new projects we use Telethon or another actively maintained MTProto library. Existing Pyrogram code we keep pinned and tested, or migrate when it blocks a feature.

  • Pin and test

    Pin library versions, run tests against a test account, and read the changelog before every upgrade.

  • Plan the migration

    Move one workflow at a time and expect a fresh login, since each library stores sessions in its own format.

  • Vet any fork

    Community forks of Pyrogram exist; review a fork's activity and code before trusting it with an account.

Primary sources

  • GitHub: pyrogram/pyrogramArchived on 23 December 2024; the README states the project is no longer maintained or supported.
  • Codeberg: Telethon repositoryTelethon's current home: v1 is mostly in maintenance mode, new API layers are still added, and v1.45 was released in September 2026.

Protect API credentials and sessions like passwords

Every MTProto app needs its own api_id and api_hash, created under API development tools at my.telegram.org, and each phone number can have only one api_id. Telegram places accounts that log in through unofficial clients under automatic observation, and bans accounts that use the API for flooding, spam, or faked channel counters. After login, the library stores a session holding the authorization key, and Telethon's documentation warns that anyone with a session string can log in to the account. We keep sessions encrypted in a secret store and run each one from a single place.

  • Registered to you

    Create the api_id under your organization's own account, so the application and its access stay yours.

  • Secrets out of code

    Keep session strings and the api_hash in a secret manager, readable only by the service that needs them.

  • Two-step verification

    Keep two-step verification on for every automated account, so a stolen login code alone cannot take it over.

Primary sources

Respect FLOOD_WAIT and Telegram's API Terms

Telegram answers excessive requests with error 420 and FLOOD_WAIT_X, where X is the number of seconds to wait before repeating the action. Our tools wait the full time, slow the whole job, and log the event instead of retrying around it, and jobs read gradually rather than all at once. The API Terms add duties for any app: guard users' privacy with utmost care, never interfere with Telegram's basic functionality, keep the word Telegram out of the app's name, avoid the official logo, and tell users the app runs on the Telegram API. Breaches can end the app's API access.

  • Your accounts, public content

    Work only with accounts you own and with public channels or chats you belong to, never member lists or unsolicited messages.

  • Real accounts only

    No fake or purchased accounts, and no account networks built to multiply limits.

  • Custom client duties

    A custom client must say it uses the Telegram API, carry its own name and logo, and support official sponsored messages in channels.

Primary sources

  • Telegram API: Error handlingError 420 FLOOD and FLOOD_WAIT_X, the number of seconds to wait before repeating a request.
  • Telegram API Terms of ServicePrivacy duties, the ban on interfering with basic functionality, branding rules, sponsored messages, and loss of API access for breaches.

Realistic limits and operator controls

  • A real account carries real risk

    Automation runs on an actual Telegram account, and mistakes, aggressive pacing, or user reports can get it limited or banned, so jobs start slowly.

  • Public data can still be personal

    Posts in public channels can contain personal data, so a research project needs a lawful basis, minimal collection, and a retention plan; confirm your obligations with qualified counsel.

  • Libraries can stall

    Open-source MTProto libraries depend on small groups of maintainers, and one has already stopped, so plan for upgrades and a possible migration.

Frequently asked questions

Should a new project use Pyrogram or Telethon?

Telethon, or another actively maintained MTProto library. Pyrogram's official repository has been archived since December 2024, so code built on it gets no upstream fixes.

Can you take over our existing Pyrogram script?

Yes. We review the code and how sessions are stored, fix what is urgent, then keep it running on a pinned version or migrate it to a maintained library.

Can it collect group members or add people to our group?

No. Member scraping, mass invites, and unsolicited messages break Telegram's rules and put accounts at risk. We build for your own accounts, your own data, and public content.

Do we need MTProto to handle large files?

Not necessarily. A bot running against a self-hosted Bot API server can upload files up to 2000 MB, which covers many file workflows without a user session.

Scope an MTProto tool within Telegram's rules

Share the accounts or channels involved, what the tool must read or send, the data you need to keep, and any existing Pyrogram or Telethon code. We will check whether a bot can do it first, then propose the client design.

Start a project