# Host a Telegram bot that stays online

> Run your Telegram bot from GitHub on servers in the EU, with polling or webhooks, and keep it online at any hour. Free to try, from 2 EUR a month to keep it running.

Web page: https://blitz.cloud/guides/telegram-bot-hosting/
Updated: 2026-10-28

A Telegram bot is only useful if it answers when someone writes to it, at 3 in the morning too. On blitz.cloud you put the bot's GitHub repository online in a few minutes, on servers in the EU, and every push builds a new version. How you keep it running depends on how your bot gets its messages.

## Polling or webhook?

Telegram hands a bot its messages in one of two ways.

- **Polling** (`getUpdates`, `run_polling()` in python-telegram-bot, `bot.launch()` in Telegraf without a webhook): the bot asks Telegram for new messages itself. It needs no address. Run it in the background.
- **Webhook** (`setWebhook`): Telegram sends each message to an HTTPS address of yours. The bot needs an address that answers at any hour.

If you aren't sure, polling is the simpler choice here.

## A polling bot, in the background

1. Click "Host something new", then "My own code", and pick the bot's repository.
2. When you name the app, switch on "Runs in the background". The bot gets no address and never goes to sleep.
3. Put the token from BotFather on the app's Environment tab, for example as `TELEGRAM_TOKEN`. Settings are encrypted before they are stored.
4. Build it. The Logs tab shows what the bot prints.

On the free plan one background app runs at a time, and it stops after 2 days in which nobody signs in, deploys or opens the dashboard. We email you a day before, and Start runs it again. To have it run without that, make it a Pro app for 2 EUR a month, or take Pro for 7 EUR a month, which runs as many background bots as you like. Neither stops.

## A webhook bot, with an address

Deploy it as a normal app with an address, like `bot.yourname.blitz.cloud`, and point the webhook there. The bot should listen on the port in `PORT` (`8080`). HTTPS is set up for you.

On the free plan an app with an address sleeps after 15 minutes without a visitor, and Telegram's requests don't wake it, so messages would get lost. Keep it awake as a Pro app or on Pro. Then it answers every update, and it can also live on a domain you own.

## A database and a dashboard

If the bot keeps users or settings, create a PostgreSQL or Redis database on the Databases page and connect it; the address arrives as an environment variable, and the database is backed up every night. A bot and its web dashboard from one repository go online as one app of several parts: the bot keeps running while the dashboard sleeps. See [several services in one repository](https://blitz.cloud/docs/deploy-from-github/#several-services-in-one-repository).

## Questions

### What does it cost?

Trying it is free and needs no card. Keeping a bot running for good is 2 EUR a month (or 15 EUR a year) as a Pro app, or 7 EUR a month on Pro for all your apps. The first month of Pro is refunded if you ask within 30 days.

### Does my bot need a Dockerfile?

No. If the repository has none, we write one from `requirements.txt` or `package.json` and fix it if the build fails. If you have your own, we use it.

### Where does it run?

On blitz.cloud's servers in the EU, run by BlitzWorks, a company in Germany.
