Telegram bot hosting

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.

Decide first

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.

WebhookLong polling
How it worksTelegram sends each new message to your HTTPS address.Your bot keeps asking Telegram “anything new?” with getUpdates.
Needs HTTPS / a domainYes — ports 443, 80, 88 or 8443No — only outgoing requests
Needs an always-on processNo — the script runs per messageYes — the program must never stop
Typical stackA PHP file, or a small web apppython-telegram-bot, aiogram, Telegraf, grammY
Best forSimple command bots, form or alert bots, low trafficBots with state, scheduled jobs, AI chat, games
Runs on the Free Learner VPSYes, from the control panelChoose a plan with root access
Pick your starting point

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.

Create my free VPS

Step-by-step

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:

bot.php
<?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-string

You 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:

terminal
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:

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:

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.target
terminal
sudo systemctl daemon-reload
sudo systemctl enable --now mybot
journalctl -u mybot -f   # live logs

Using 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.

Ideas

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.

Troubleshooting

Why is my Telegram bot not responding?

The most common errors and what to do about each.

What you seeWhy it happensFix
Conflict: terminated by other getUpdates requestTwo 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 arrivesThe 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 UnauthorizedThe 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 groupsPrivacy 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 SSHThe process was tied to your terminal session.Run it as a systemd service (Path B, step above).
Bot stops after a few hoursAn unhandled exception crashed it, or it ran out of memory.Check journalctl -u mybot; keep Restart=always; move heavy bots to a bigger plan.
Before you launch

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-Token header on every request.
  • Auto-restartsystemd Restart=always or Docker --restart unless-stopped.
  • Logs you can readjournalctl -u mybot shows every crash with a timestamp.
  • Respect rate limitsSpace out broadcasts; Telegram returns 429 with 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.

FAQ

Telegram bot hosting questions

Can I host a Telegram bot for free?
Yes. The Free Learner VPS costs nothing and needs no credit card. It includes 500 MB of disk and runs for 7 days, which is enough to build and test a webhook bot. When your bot needs to stay online long-term, pick a larger plan from your dashboard.
Should my Telegram bot use polling or a webhook?
Use a webhook if your bot is a script that only needs to run when a message arrives, such as a PHP file behind HTTPS. Use long polling if your bot is a Python or Node.js program that runs all the time; it needs no domain or SSL but must be kept alive with something like systemd.
Which programming languages can I use for my bot?
On the Free Learner VPS you can run PHP webhook bots straight from the control panel. Plans with root access let you run any language, including Python (python-telegram-bot, aiogram), Node.js (Telegraf, grammY), Go and PHP.
How much RAM and disk does a Telegram bot need?
A simple command, notification or echo bot is tiny: the code is a few kilobytes and it usually runs in a few dozen megabytes of memory. Bots that process images, video or large AI models need noticeably more, so move them to a bigger plan.
Why does my bot stop when I close the SSH window?
Because the program was tied to your terminal session. Run it as a systemd service with Restart=always instead. It then starts on boot, restarts after crashes and keeps running after you log out.
Does a Telegram webhook need HTTPS?
Yes. Telegram only delivers webhook updates to an HTTPS address on port 443, 80, 88 or 8443. Long polling has no such requirement because your bot makes outgoing requests to Telegram.
How do I keep my bot token safe?
Keep the token in an environment file or a config file outside your public web folder, never commit it to Git, and use a 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?
Yes. Give each webhook bot its own script address, or give each polling bot its own systemd service. Each bot needs its own token, and one token should only be used by one running instance.

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.

Host my bot free