python-telegram-bot hosting, the Application way
PTB version 20 and later is async and polls with one line. Push the repository, set BOT_TOKEN, deploy: the bot runs around the clock, restarts if it exits and redeploys on push.
A minimal bot that deploys as is
import os
from telegram import Update
from telegram.ext import Application, CommandHandler, ContextTypes
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
await update.message.reply_text("Hello from FadeHost")
app = Application.builder().token(os.environ["BOT_TOKEN"]).build()
app.add_handler(CommandHandler("start", start))
app.run_polling()Save it as bot.py, put python-telegram-bot in requirements.txt (add the [job-queue] extra if you schedule jobs), push.
Job queues, persistence and data
PicklePersistence writes a file: point it under /data so it survives redeploys. A JobQueue runs inside the same process, so it keeps running as long as the bot does, which on FadeHost is always. Bigger data goes to a managed database on the private network.
Version pitfalls
Tutorials older than 2023 use Updater and use_context, which are PTB 13. Pin the version your code was written for: python-telegram-bot==13.15 for the old style, python-telegram-bot==21.* for the Application style above. A mismatch is the most common failed start on this library.
Frequently asked questions
Can I use PTB 13 code?
Yes. Pin python-telegram-bot==13.15 in requirements.txt and it runs unchanged. Upgrading to 20+ is a rewrite of the handlers to async.
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.