Your Telegram bot, online around the clock — starting free.
Stop running your bot on a laptop that sleeps. Put it on a VPS, keep it alive with one service file, and let it answer every message — even at 3 a.m.
- No credit card
- Webhook or polling
- Python, Node.js, PHP
What is Telegram bot hosting?
Telegram bot hosting means running your bot's code on a server that stays online, so it can receive and answer messages at any hour. On freevpsserver.net you can start a bot on the Free Learner VPS with just an email — no card — and move to a larger plan from your dashboard when the bot needs to run long-term.
Webhook or long polling: which does your bot need?
Telegram can deliver messages to your bot in two ways. The choice decides what kind of hosting you need, so make it before you write a line of code.
| Webhook | Long polling | |
|---|---|---|
| How it works | Telegram sends each new message to your HTTPS address. | Your bot keeps asking Telegram “anything new?” with getUpdates. |
| Needs HTTPS / a domain | Yes — ports 443, 80, 88 or 8443 | No — only outgoing requests |
| Needs an always-on process | No — the script runs per message | Yes — the program must never stop |
| Typical stack | A PHP file, or a small web app | python-telegram-bot, aiogram, Telegraf, grammY |
| Best for | Simple command bots, form or alert bots, low traffic | Bots with state, scheduled jobs, AI chat, games |
| Runs on the Free Learner VPS | Yes, from the control panel | Choose a plan with root access |
Which plan fits your Telegram bot?
Start free while you build. Move up only when your bot has real users.
Free Learner VPS
Build and test — no card needed
- 500 MB of disk, runs for 7 days
- Control panel with file manager and database
- Ideal for PHP webhook bots
- Perfect for trying your bot before launch
Good for: learning, prototypes, a demo bot for a client.
Larger plans in your dashboard
For bots that must stay up for good
- Full root access — install any language or library
- Run polling bots as systemd services
- Docker, Redis, Postgres alongside your bot
- Add CPU, RAM or disk when the bot grows
Good for: AI chat bots, group moderators, bots with many users.
How to host a Telegram bot on a free VPS
About 15 minutes from zero to a bot that answers. Follow Path A for a webhook bot on the free plan, or Path B for a Python polling bot on a plan with root access.
Create the bot in BotFather
Open @BotFather in Telegram, send /newbot, choose a display name and a username ending in bot. BotFather replies with a token like 123456789:AA…. Treat it like a password.
Create your free VPS
Sign up with your email, confirm it, and choose a plan in your dashboard. Your VPS is ready in about a minute. Create it here.
Path A Upload a webhook bot
In the control panel, enable SSL for your address (Telegram only talks to HTTPS). Then open the file manager and create bot.php in your public folder:
<?php
// Keep the token outside the public folder in real projects
$token = 'PASTE_YOUR_BOT_TOKEN';
$secret = 'any-long-random-string';
// Reject requests that are not from Telegram
if (($_SERVER['HTTP_X_TELEGRAM_BOT_API_SECRET_TOKEN'] ?? '') !== $secret) {
http_response_code(403); exit;
}
$update = json_decode(file_get_contents('php://input'), true);
if (empty($update['message'])) exit;
$chat = $update['message']['chat']['id'];
$text = $update['message']['text'] ?? '';
$reply = $text === '/start'
? 'Hi! I am online on my own VPS.'
: 'You said: ' . $text;
file_get_contents("https://api.telegram.org/bot$token/sendMessage?" .
http_build_query(['chat_id' => $chat, 'text' => $reply]));Now tell Telegram where to send messages. Open this address once in your browser (swap in your token, domain and secret):
https://api.telegram.org/bot<TOKEN>/setWebhook?url=https://<your-domain>/bot.php&secret_token=any-long-random-stringYou should see "ok":true. That's it — the script runs each time someone messages your bot.
Path B Deploy a Python polling bot
SSH into your VPS, create a user and folder for the bot, and install the library in a virtual environment:
sudo apt update && sudo apt install -y python3-venv
sudo useradd -m -s /bin/bash bot
sudo -iu bot bash -c 'mkdir -p ~/mybot && cd ~/mybot && python3 -m venv venv && venv/bin/pip install python-telegram-bot'Save this as /home/bot/mybot/bot.py:
import os
from telegram import Update
from telegram.ext import ApplicationBuilder, CommandHandler, MessageHandler, ContextTypes, filters
async def start(update: Update, ctx: ContextTypes.DEFAULT_TYPE):
await update.message.reply_text("Hi! I'm online 24/7.")
async def echo(update: Update, ctx: ContextTypes.DEFAULT_TYPE):
await update.message.reply_text(update.message.text)
app = ApplicationBuilder().token(os.environ["BOT_TOKEN"]).build()
app.add_handler(CommandHandler("start", start))
app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, echo))
app.run_polling()Put the token in /home/bot/mybot/.env as one line: BOT_TOKEN=123456789:AA…
Path B Keep it alive with systemd
Running python bot.py in a terminal stops the bot when you log out. A service restarts it on crashes and on reboot. Create /etc/systemd/system/mybot.service:
[Unit]
Description=My Telegram bot
After=network-online.target
Wants=network-online.target
[Service]
User=bot
WorkingDirectory=/home/bot/mybot
EnvironmentFile=/home/bot/mybot/.env
ExecStart=/home/bot/mybot/venv/bin/python bot.py
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.targetsudo systemctl daemon-reload
sudo systemctl enable --now mybot
journalctl -u mybot -f # live logsUsing Node.js instead? The same service file works — point ExecStart at /usr/bin/node bot.js. Prefer Docker? Run the container with --restart unless-stopped.
Test it
Send /start to your bot. If it stays quiet, jump to the error fixes below — nine times out of ten it is one of them.
What people host as Telegram bots
AI chat assistants
Connect an LLM API and answer questions in DMs or groups.
Alerts & notifications
Server monitoring, price drops, form submissions, order updates.
Group moderation
Welcome messages, anti-spam, captcha for new members.
Channel auto-posting
Forward RSS feeds or scheduled posts to your channel.
Support desks
Collect customer questions and route them to your team.
Mini App backends
The API and database behind a Telegram Mini App.
Quiz & game bots
Leaderboards and game state saved in your own database.
Personal tools
Reminders, notes, file downloads — a bot just for you.
Why is my Telegram bot not responding?
The most common errors and what to do about each.
| What you see | Why it happens | Fix |
|---|---|---|
Conflict: terminated by other getUpdates request | Two copies of the bot are polling with the same token, or a webhook is still set. | Stop the extra copy (pkill -f bot.py), or call deleteWebhook before polling. |
| Webhook set, but nothing arrives | The address isn't HTTPS, uses an unsupported port, or returns an error. | Open getWebhookInfo and read last_error_message. Use port 443, 80, 88 or 8443. |
401 Unauthorized | The token is wrong, has a stray space, or was revoked. | Copy it again from @BotFather. Check the .env file has no quotes or spaces. |
| Bot ignores messages in groups | Privacy mode is on, so the bot only sees commands and replies. | In @BotFather send /setprivacy → Disable, then re-add the bot to the group. |
| Bot dies after you close SSH | The process was tied to your terminal session. | Run it as a systemd service (Path B, step above). |
| Bot stops after a few hours | An unhandled exception crashed it, or it ran out of memory. | Check journalctl -u mybot; keep Restart=always; move heavy bots to a bigger plan. |
A production checklist for your bot
- Token out of your codeUse an env file or a config file outside the public folder. Never commit it.
- Secret token on webhooksCheck the
X-Telegram-Bot-Api-Secret-Tokenheader on every request. - Auto-restartsystemd
Restart=alwaysor Docker--restart unless-stopped. - Logs you can read
journalctl -u mybotshows every crash with a timestamp. - Respect rate limitsSpace out broadcasts; Telegram returns
429with a retry time if you send too fast. - Back up your dataDump the bot's database regularly so a bad deploy can't wipe users.
Building something bigger than a bot? See our free Linux VPS, start a free VPS trial, or read the free VPS server overview.
Telegram bot hosting questions
Can I host a Telegram bot for free?
Should my Telegram bot use polling or a webhook?
Which programming languages can I use for my bot?
How much RAM and disk does a Telegram bot need?
Why does my bot stop when I close the SSH window?
Restart=always instead. It then starts on boot, restarts after crashes and keeps running after you log out.Does a Telegram webhook need HTTPS?
How do I keep my bot token safe?
secret_token on your webhook. If a token leaks, send /revoke to @BotFather to issue a new one.Can I run more than one bot on one VPS?
Get your bot off your laptop today.
Create a free VPS with just an email, drop in your bot, and let it answer messages while you sleep.