---
title: "How to host a Telegram bot on a VPS in Brazil | StreetHosting"
description: "Keep your Telegram bot online 24/7 on a VPS: BotFather token, polling versus webhook, process management and how to protect the server."
url: "https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps"
type: "page"
language: "en-US"
---

VPS · 3 min · Intermediate

Published on Jun 17, 2026 · Updated on Jun 17, 2026

# How to host a Telegram bot on a VPS

Running a Telegram bot on your PC only works while the PC is on. On a VPS the bot stays online 24/7. See the token, polling or webhook, and how to keep the process alive.

By [Equipe StreetHosting](https://streethosting.com.br/en/autores#equipe-streethosting) · StreetHosting infrastructure and support team

[Monitoring and alerts](https://streethosting.com.br/en/guides/topics/monitoring) [Deploying and running apps](https://streethosting.com.br/en/guides/topics/deploy) [Automation and webhooks](https://streethosting.com.br/en/guides/topics/automation)

Summarize with:

[](https://chat.openai.com/?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fhost-telegram-bot-on-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "ChatGPT") [](https://claude.ai/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fhost-telegram-bot-on-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Claude") [](https://www.google.com/search?udm=50&aep=11&q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fhost-telegram-bot-on-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Google AI Mode") [](https://x.com/i/grok?text=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fhost-telegram-bot-on-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Grok") [](https://www.perplexity.ai/search/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fhost-telegram-bot-on-vps.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Perplexity")

Share:

[](https://x.com/intent/tweet?text=How%20to%20host%20a%20Telegram%20bot%20on%20a%20VPS%20in%20Brazil&url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fhost-telegram-bot-on-vps "Share on X") [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fhost-telegram-bot-on-vps "Share on Facebook") [](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fhost-telegram-bot-on-vps "Share on LinkedIn") [](https://wa.me/?text=How%20to%20host%20a%20Telegram%20bot%20on%20a%20VPS%20in%20Brazil%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Fvps%2Fhost-telegram-bot-on-vps "Share on WhatsApp")

For agents: Copy as Markdown [.md](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps.md)

In this guide 5 sections

* [Why a VPS](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#por-que-vps)
* [Create the bot](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#criar-o-bot)
* [Polling or webhook](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#polling-ou-webhook)
* [Keep it online](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#manter-online)
* [Token security](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#seguranca)

Quick answer

To host a **Telegram bot**, create the bot with BotFather and copy the token, send the code to the VPS and store the token in an environment variable. Choose **polling** to start simple or a **webhook** with HTTPS for scale. Use PM2 or systemd to keep the bot online 24/7, even after a crash or a reboot.

## Why a VPS[](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#por-que-vps)

Running the bot on your own computer means it only works while that computer is on and connected. On a VPS, the bot stays up the whole time, with a stable IP and no dependence on your internet connection. The same reasoning applies to any service that needs availability, as the guide on [creating your first bot from scratch](https://streethosting.com.br/en/guides/discord-bots/create-discord-bot) shows.

## Create the bot[](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#criar-o-bot)

1. In Telegram, open a chat with BotFather.
2. Create the bot and copy the generated token.
3. Send the code to the VPS and install the dependencies.
4. Put the token in an environment variable, never in the code.

## Polling or webhook[](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#polling-ou-webhook)

Start with polling, which is straightforward and does not need a domain. When the bot grows or needs faster responses, switch to a webhook. A webhook needs an HTTPS address, so pair it with an [Nginx reverse proxy](https://streethosting.com.br/en/guides/vps/nginx-reverse-proxy-vps) to terminate the encryption.

There is no shame in staying on polling. Plenty of useful bots run that way for years. Only switch to a webhook when you have a clear scaling reason.

## Keep it online[](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#manter-online)

A bot that does not restart on its own goes offline at the first failure. Set up PM2 or systemd to bring the process back and start it at boot, as described in [PM2 or systemd for your application](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs).

## Token security[](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#seguranca)

The bot token gives full control of the bot. Never post it in screenshots, commits or public messages. If it leaks, generate a new one in BotFather immediately.

* Token in an environment variable, outside the code
* Process restarting on its own with PM2 or systemd
* HTTPS configured if you use a webhook
* Resource usage monitored to size the plan

To host bots with low latency and support in Portuguese, check out the [bot plans](https://streethosting.com.br/en/bots) and the [Ryzen VPS](https://streethosting.com.br/en/vps/ryzen).

In this guide

* [Why a VPS](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#por-que-vps)
* [Create the bot](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#criar-o-bot)
* [Polling or webhook](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#polling-ou-webhook)
* [Keep it online](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#manter-online)
* [Token security](https://streethosting.com.br/en/guides/vps/host-telegram-bot-on-vps#seguranca)

## Frequently asked questions

What is the difference between polling and webhook?

With polling, the bot asks Telegram for news every so often. With a webhook, Telegram notifies the bot when something arrives, using an HTTPS address. Polling is simpler, webhook scales better.

Does a webhook need a domain and HTTPS?

Yes. A webhook requires a reachable address with a valid certificate. That is why it usually comes with a reverse proxy with HTTPS on the VPS. If you want to avoid that at first, start with polling.

How many resources does a Telegram bot use?

Simple bots are light and run on little RAM. Usage grows with heavy features, media and many users. Start small and monitor, moving up a plan as real demand grows.

Can I run a Telegram bot and a Discord bot on the same VPS?

Yes, with isolation and monitoring. Use separate users and processes and watch resource usage so one bot does not affect the other. At scale, splitting them across separate machines is more stable.

Next step

See VPS plans

Root VPS in Brazil with NVMe and Anti-DDoS.

[See VPS plans](https://streethosting.com.br/en/vps)

[See Ryzen VPS Ryzen 9 9950X VPS in São Paulo with root access, NVMe and gamer Anti-DDoS.](https://streethosting.com.br/en/vps/ryzen) [See bot plans 24/7 Discord bots with fast activation and support in Portuguese.](https://streethosting.com.br/en/bots)

## Related guides

[VPS Intermediate PM2 vs systemd: keep your Node app always online on a VPS Your app needs to come back on its own after a crash and start together with the VPS. PM2 and systemd solve this in different ways. Here is how to set up each one and which to pick. 3 min Read guide](https://streethosting.com.br/en/guides/vps/pm2-vs-systemd-nodejs) [VPS Intermediate How to set up Nginx as a reverse proxy on a VPS Your app runs on an internal port and you want to serve it on a domain with HTTPS. Nginx as a reverse proxy solves that and also brings several apps together in one place. 3 min Read guide](https://streethosting.com.br/en/guides/vps/nginx-reverse-proxy-vps) [Discord bots Beginner How to create your first Discord bot from scratch Never built a bot and not sure where to start? Here is the path from zero: create the application, get the token, invite the bot with the right permissions, and make it reply. 3 min Read guide](https://streethosting.com.br/en/guides/discord-bots/create-discord-bot)

[← Back to the Guide Center](https://streethosting.com.br/en/guides)
