NetrunHome

Free hosting for a Python Telegram bot (aiogram)

· 5 min read

Your Python bot is ready: commands respond, aiogram is running, everything works on your computer. But the moment you close your laptop, the bot goes silent — because it lives locally on your machine. For it to answer around the clock, you need a computer that never shuts down, and usually that means renting a VPS, installing Python on the server, setting up autostart through systemd, and watching that the process does not crash.

For a bot on aiogram or pyTelegramBotAPI you can skip all of that. Let us walk through how to prepare your bot and put it on free hosting where it will run without your computer and without any manual server setup.

  1. Collect your dependencies in requirements.txt

    Create a requirements.txt file in the root of your project and list the libraries in it — aiogram itself (or pyTelegramBotAPI) and everything your bot uses. You do not need to put the folder with installed libraries (venv) into the archive: the platform builds the environment from this list on its own.

  2. Move the bot token out of your code

    The token that BotFather gave you should not sit right in the code, and definitely should not end up in a public repository — otherwise someone could steal your bot. Read the token from an environment variable. When you set up the project, Netrun asks for this value and injects it as a secret outside your code.

  3. Use long polling, not a webhook

    For a simple bot the easiest approach is to stay in long polling mode — where the bot itself asks Telegram for new messages. That way you do not need to run a web server, configure a webhook, or open a port. aiogram and pyTelegramBotAPI work in this mode out of the box, and for hosting it is the most trouble-free option.

  4. Check the start command

    Make sure the bot starts with a single command — for example, python bot.py — and does not need any manual steps after it launches. If your entry point has a different name, the platform will offer to specify the start command during setup.

  5. Upload the project to Netrun

    Upload the code as a ZIP archive or import it from a GitHub repository — a private one works too. Netrun detects on its own that this is Python and recognizes the project as a bot. You do not need to pick a server, a Python version, or a way to start it manually.

  6. Start and check the bot

    Once the build finishes, the bot starts and begins answering in Telegram. Logs are visible in your dashboard in real time, so if the bot does not respond, the reason will be clear. On the Free plan a Telegram bot runs continuously: every incoming message keeps it active, so a bot does not sleep the way ordinary websites do.

A Python bot needs neither your always-on computer nor a rented VPS with systemd. Upload your code to Netrun, move the token into a secret — and the bot will answer around the clock. On the Free plan one such bot runs at no cost.

Common questions

Where can I host a Python Telegram bot for free?

On the Netrun Free plan you can keep one Python bot at no cost. The bot runs around the clock because every incoming message keeps it active — a bot does not sleep the way websites do.

Does this work for aiogram and pyTelegramBotAPI?

Yes. Netrun detects that this is a Python project and starts the bot regardless of the library. The main things are to collect your dependencies in requirements.txt, move the token into an environment variable, and stay in long polling mode.

Do I need a webhook and a web server?

No, for a simple bot long polling mode is enough — the bot fetches messages from Telegram itself. You do not need to run a web server, configure a webhook, or open a port.

Will the bot keep working when my computer is off?

Yes. After you put it online the bot lives on Netrun servers, not on your computer, so it answers regardless of whether your laptop is on.

Is it safe to store the bot token?

Yes, if you move the token into an environment variable and set it as a secret during setup. Then the token is not in your code or repository, and in the Netrun database it is stored encrypted.