# Host a Telegram bot

Your Telegram bot always online, with your computer off. Polling needs no domain or port; your AI agent puts it on Estiba. A small bot: about $0.38 a month.

## Why it stops when you close your laptop

A Telegram bot is a program that gets its messages from Telegram and answers them. While it runs on your computer, it answers only while the computer is on and the program is open. To keep it answering, it has to run on a server, a computer that is always on.

## Polling or webhook: the one choice to make

Telegram's Bot API hands a bot its messages in one of two ways, never both at once. Which one your bot uses decides how it runs on Estiba:

- **Long polling** (`getUpdates`, what most libraries do by default, such as `run_polling()` in python-telegram-bot or `bot.launch()` in Telegraf): the bot asks Telegram for messages. It needs no domain and no port, and on Estiba it runs all the time and never sleeps. This is the simple choice.
- **Webhook** (`setWebhook`): Telegram sends each message to an HTTPS address of the bot. The bot is then a small website: it needs a domain of yours, and HTTPS is set up for you, with the certificate issued and renewed by Cloudflare (Telegram only sends to HTTPS: give it the `https://` address with no port, once the domain is active). Like any website it sleeps after 5 minutes with no requests, and the first message after that waits a moment while it starts; ask your agent to keep it always on if it must answer at once. See [Domains](https://estiba.cloud/docs/domains).

A bot that once had a webhook and now polls gets nothing until the webhook is removed (`deleteWebhook`); your agent sees the error in the logs and does it.

## Put it online

1. [Sign up](https://app.estiba.cloud) and [connect your agent](https://estiba.cloud/docs/connect-your-agent) to Estiba, once.
2. Stop the copy that runs on your computer. Two copies polling for the same bot get in each other's way, and one of them fails with a `Conflict` error.
3. Ask your agent, in the folder of your bot: "put this Telegram bot online on Estiba". Give it the bot's token, the one [@BotFather](https://t.me/BotFather) gave you (`/revoke` there makes a new one). Your agent has the bot read the token from an environment variable, moves it out of the code if it was there, and creates the service with the token as a secret: stored encrypted, its value never shown again. It adds a `Dockerfile` if the project has none and sends the code, leaving out files such as `.env`.
4. [Add credit](https://estiba.cloud/docs/credit-and-prices), from $5. Estiba builds the bot and starts it once there is credit.
5. Check it. With polling, send the bot `/start` from Telegram: it answers. With a webhook, your agent points it at the bot's address with `setWebhook`, and `getWebhookInfo` shows that address with no `last_error_message`.

Any language with a Bot API library works: python-telegram-bot, aiogram, Telegraf, grammY, or anything that runs in a container. Your agent reads the logs after each change and fixes what fails. To change the bot later, ask it again.

## What it costs

You pay for what the bot uses, measured every second: $4 per GB of memory and $8 per vCPU busy, a month, taxes included. Traffic is free. See [Credit and prices](https://estiba.cloud/docs/credit-and-prices).

For example, a polling bot that holds 80 MB of memory and keeps 0.5 % of a vCPU busy on average costs 0.08 × $4 + 0.005 × $8 = $0.36 a month. A bot built from your code also keeps its image, at $0.10 per GB a month: a 200 MB image adds $0.02. About **$0.38 a month**, so $5 of credit keeps it online for about a year. A webhook bot that sleeps most of the day costs less still. The dashboard shows what yours really uses and costs each day. No bill arrives; if the credit runs out, the bot stops until you add more.

## Keep its data

A bot that saves data in files (users, settings, a SQLite database) loses them when it is deployed again, unless they are in a volume. Ask your agent to put that folder in a volume: it keeps its files and costs $0.10 per GB a month. See [Deploy an app](https://estiba.cloud/docs/deploy-an-app).

## If a server goes down

A bot with no volume starts on another server by itself within a couple of minutes. A bot with a volume, which every bot built from your code has (it holds its image), waits for its server to come back instead, so its files are never left behind. Telegram keeps messages it could not deliver for up to 24 hours, so a short stop usually loses nothing.

## Compared with other places

Month-to-month plans that keep a bot on all the time, as listed on their own pages on 18 November 2026 (Estiba's prices include taxes):

| | Price | Notes |
| --- | --- | --- |
| [Render](https://render.com/pricing) | $7 a month | 512 MB, 0.5 CPU. Its [free instances](https://render.com/docs/free) are not for background workers. |
| [Railway](https://railway.com/pricing) | $5 a month | Hobby, which includes $5 of usage; past it, about $10 per GB of memory and $20 per vCPU a month. Its Free plan gives $1 of usage a month. |
| [PlayNHost](https://playnhost.com/telegram-bot-hosting/) | $1.99 a month | Starter: 0.5 GB, 3 GB of disk, a database; less a month if paid for longer. |

Where they are better: a fixed plan is easier to predict, some hosts have free plans, and a bot that holds 1 GB of memory all month costs $4 on Estiba for the memory alone, plus its CPU and volume, but $2.99 on PlayNHost's 1 GB plan. Estiba is for the small bot that waits for messages most of the day, and for having your agent put it online and look after it. Hosting a Discord bot instead? See [Host a Discord bot](https://estiba.cloud/docs/discord-bot-hosting).
