Python Telegram bot hosting, from a GitHub repository
aiogram, python-telegram-bot, pyTelegramBotAPI or Telethon in bot mode: connect the repository, set the token, deploy. Python is detected from requirements.txt, the bot runs around the clock in its own sandbox, and every push redeploys it.
What the repository needs
- requirements.txt at the root with your library pinned, for example
aiogram==3.*orpython-telegram-bot==21.*. - An entry file named bot.py or main.py, or a start command such as
python -m mybotset on the bot's page. - The token read from the environment:
os.environ["BOT_TOKEN"]. Nothing secret in the code.
Python 3 is picked from the repository, dependencies install into a virtual environment we keep for you, and the process restarts if it exits.
Polling is enough for most bots
A polling bot needs no port and no address: it asks Telegram for updates and answers them. That is the default of every Python library and it runs fine on the free tier. Switch to a webhook only when you need Telegram to call you, which takes a paid app, where the address stays up.
Data that has to survive a restart
Files written under /data stay across redeploys, so a SQLite database or a JSON file lives there. For more than that, a managed MySQL or PostgreSQL database is one click away and reachable over the private network only.
Frequently asked questions
Which Python Telegram libraries work?
Anything on PyPI: aiogram, python-telegram-bot, pyTelegramBotAPI (telebot), Telethon and Pyrogram in bot-token mode. The runtime installs requirements.txt and runs your entry file.
Polling or webhook?
Polling works everywhere and needs nothing but the token: the bot asks Telegram for updates. A webhook needs a public https address; every hosted app has one at name.fadehost.app with its plan, but on the free tier that address sleeps when idle, so polling is the simpler choice for a free bot and a webhook is for a paid app that stays up.
Where does the token go?
In the environment variables of the app, as BOT_TOKEN or whatever name your code reads, never in the repository. The panel masks the values and injects them when the bot starts.
What happens when I push a commit?
With auto-deploy on, every push to the branch you chose redeploys the bot: install, build if there is one, start. The live console shows each step and the crash doctor explains a failed start in plain words.
What does the free tier include?
One bot with 256 MB of RAM, always on, placed where there is room for it (a paid plan picks the region), with the live console, environment variables and redeploys on push. A second bot or more memory is the Starter plan at $2 a month.