Skip to content

Running Your Telegram Bot on a Server


You will likely need a server, because you will want to get your program running with a stable power and internet connection.

For that, you will need to buy a host. Bot programs usually need a small amount of resources, so a simple plan from any hosting provider will probably be fine.

This is a place for an ad of your cool hosting :)

Long-polling vs webhooks

Setting up a server depends on how your bot works. The default option is long-polling, meaning that the program regularly sends requests to the server to get new updates. But if you use Bot API, your program can alternatively be a webhook, meaning that Telegram servers will make requests to the program whenever there are updates.

To set up a webhook, you will need to receive requests through a web application. For aiogram library, there are built-in features to integrate with aiohttp or any other asynchronous web framework.

Free hosting

If you are unable to pay for hosting, you can try PythonAnywhere (which works unstably) or Yandex Cloud Functions.