Home / Servers / Telegram Bot VPS

Host Telegram bots 24/7 on a no-KYC VPS

Run aiogram, python-telegram-bot, Telegraf or grammY bots on a Linux server that stays on when your computer is off. A bot needs a few hundred MB of RAM, so the smallest plan runs one, and Blackbox Core has room for several, their database and the local Bot API server. Sign up with a generated credential and pay with crypto, card or cash by mail.

Deploy a bot server from $4.99 a monthenough for a bot
  • Polling or webhooks
  • Any language that runs on Linux
  • IPv4 for webhooks, IPv6 on Blackbox
  • No KYC

Polling or webhook

Telegram delivers updates one of two ways, never both at once. Most bots never need to leave polling.

Long pollingWebhook
How updates arrive The bot asks Telegram with getUpdates and waits for the answer Telegram sends an HTTPS POST to your server
Domain and certificate Not needed HTTPS with TLS 1.2 or newer. A self-signed certificate issued to the IP address works if you upload it with setWebhook
Inbound ports None 443, 80, 88 or 8443 only
Address Any IPv4 only. Telegram does not deliver webhooks over IPv6
Processes per token One. A second copy gets 409 Conflict As many as your proxy spreads requests over
Fits best Most bots, and any bot under development Busy bots, and bots behind a load balancer

Every Servury server has its own public IPv4 address, so either mode works on any plan.

An aiogram bot under systemd

On Ubuntu 24.04, Debian 12 or Debian 13, as root. The bot polls, runs as its own user, and keeps its token in a file only that user can read.

apt update && apt install -y python3-venv git

# A system user with no shell, and the bot's folder
useradd --system --create-home --home-dir /opt/tgbot --shell /usr/sbin/nologin tgbot
cd /opt/tgbot
python3 -m venv .venv
.venv/bin/pip install aiogram
# Your own code instead of bot.py below? The folder is not empty, so clone
# elsewhere and copy it in:
# git clone https://github.com/you/your-bot.git /tmp/your-bot && cp -a /tmp/your-bot/. /opt/tgbot/

cat > bot.py <<'EOF'
import asyncio, os
from aiogram import Bot, Dispatcher
from aiogram.filters import CommandStart
from aiogram.types import Message

dp = Dispatcher()

@dp.message(CommandStart())
async def start(message: Message):
    await message.answer("Running on my own server.")

async def main():
    await dp.start_polling(Bot(os.environ["BOT_TOKEN"]))

asyncio.run(main())
EOF

# The token from @BotFather
printf 'BOT_TOKEN=%s\n' 'paste-your-token' > .env
chown -R tgbot:tgbot /opt/tgbot && chmod 600 .env

cat > /etc/systemd/system/tgbot.service <<'EOF'
[Unit]
Description=Telegram bot
After=network-online.target
Wants=network-online.target

[Service]
User=tgbot
WorkingDirectory=/opt/tgbot
EnvironmentFile=/opt/tgbot/.env
ExecStart=/opt/tgbot/.venv/bin/python bot.py
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable --now tgbot
journalctl -fu tgbot

What a bot uses

The smallest plan covers nearly every bot. These are the parts that grow.

A polling or webhook bot
A few hundred MB of RAM at most and almost no CPU. Blackbox Nano runs one, and Core runs several side by side.
Database
SQLite covers most bots and sits on the NVMe disk next to the code. Postgres or Redis fit on the same server.
Local Bot API server
A small C++ server on port 8081. Files your bot downloads through it stay in its working directory, so watch the disk more than the RAM.
AI bot
Calling a hosted model API costs no RAM. Running the model on the server does: a 7B or 8B model needs Blackbox Plus with 8 GB.
Media bot
ffmpeg conversions use CPU while they run. Nano has 1 vCPU, Core has 2 and Plus has 4.
Traffic
Text updates are tiny. Media is what counts against the allowance, 2 TB every 31 days on Nano and 4 TB on Core.

What breaks Telegram bots on a server

Each of these looks like an outage and comes down to configuration.

Run the bot on Blackbox

The bot token and every message your users send pass through the server's memory, and the database keeps them on disk. On a Blackbox Linux image the CPU encrypts that memory (AMD SEV-SNP) and the disk can be encrypted with a passphrase only you hold.

MontrealAmsterdamNew York City (launch pre-order)
Deploy Blackbox from $4.99 a month
  • Nano has 2 GB of RAM and 25 GB of NVMe, enough for a bot. Core has 2 vCPU, 4 GB and 50 GB, enough for several bots and their database.
  • A public IPv4 address for webhooks, and a routed IPv6 /64 for everything the bot calls out to.
  • 4 TB of transfer per 31 days on Core. Past it the port drops to 10 Mbps until the period rolls over, with nothing extra billed.
  • No guest agent, so the host has no channel to run commands inside.
  • With disk encryption on, the server waits for your passphrase after a reboot, and the bot stays offline until you unlock it.

How Blackbox works

Questions

Long-poll or webhook mode?

Start with long polling. It needs no domain, no certificate and no open port, and it is fast enough for most bots. Switch to a webhook when you want Telegram to push updates to several worker processes, or when traffic is heavy. A webhook needs HTTPS on port 443, 80, 88 or 8443 at an IPv4 address, and a reverse proxy such as Caddy gets the certificate for you.

How much RAM?

A bot written with aiogram, python-telegram-bot or grammY uses a few hundred MB at most, so the smallest plan, Blackbox Nano, runs one with memory to spare. Blackbox Core with 4 GB holds several bots, a database and the local Bot API server at once. You need more only to run a language model on the server itself: a 7B or 8B model wants Blackbox Plus with 8 GB.

Can I host the local Bot API?

Yes. Telegram's telegram-bot-api server, started with --local, raises the upload limit from 50 MB to 2000 MB, removes the 20 MB download limit, and accepts plain HTTP webhooks on any port. You need an api_id and api_hash from my.telegram.org, and you call logOut on the cloud API before pointing the bot at your server. Files it downloads stay on disk, so keep an eye on the 50 GB that Core has.

How do I keep the bot up after a crash?

Run it under systemd with Restart=on-failure, as in the example on this page, and it comes back after a crash and starts at boot. With Docker, start the container with --restart unless-stopped.

Can I run multiple bots on the same VPS?

Yes. Give each bot its own folder, .env file and systemd unit, or one template unit (tgbot@.service with WorkingDirectory=/opt/bots/%i) that you start as tgbot@shop, tgbot@alerts and so on. Each token can only be polled by one process at a time.

How do I update the bot?

git pull, install the new dependencies, then systemctl restart. To deploy on every push, let your CI log in over SSH with a key that can only run your deploy script (a command= entry in authorized_keys).

What about Telegram MTProto user-bots?

They run the same way. Telethon and other MTProto libraries log in as a user account with an api_id and api_hash instead of a bot token. Accounts driven by software must follow Telegram's API Terms of Service, and Telegram bans accounts that spam.

Does Servury log my bot traffic?

No. We keep no traffic logs for customer servers. A Blackbox has no guest agent, so nothing of ours runs inside it, and the host only counts bytes for the transfer allowance. Your account is a generated credential with no email or name on it.

Guides on this topic

Related pages

Support

Questions before you buy? Ask here. You do not need an account: your first message creates one, and you get its credential to come back for our reply.