ACLClouds
ACLClouds

Telegram bot 24/7: hosting and limits

Polling or webhook, memory, restart: what to plan so a Telegram bot stays reachable day and night, and its limits.

A Telegram bot answers its users at any hour. To stay available, it must run continuously on a machine that is always on. The choice that matters most is how it receives messages: by regular polling or by webhook.

  • Polling needs no public port; a webhook needs a reachable HTTPS address.
  • An active webhook blocks polling: delete it before switching back to polling.
  • Telegram limits the send rate: space out messages and handle refusals.

Polling or webhook

With polling, the bot regularly asks Telegram whether new messages are waiting. It needs no port open to the outside. With a webhook, Telegram sends each message to an HTTPS address you provide, so you need a public address that answers.

  • Polling: the simplest option for a bot running on a server, with no public port.
  • Webhook: useful for a web integration or heavy traffic, with an HTTPS address reachable from the Internet.
  • An active webhook blocks polling (getUpdates): delete it before switching back to polling.

Keep the process alive

A bot started on your PC stops with it. On a server, the process must restart by itself after an error. The code should therefore handle network interruptions instead of quitting at the first one.

  • Catch the exceptions in the receiving loop and log them instead of exiting.
  • Keep the token in environment variables: you can change it without touching the code.
  • After a restart, read the logs to check that the bot resumed receiving messages.

Limits to know

Telegram limits how fast a bot can send. A bot that posts too quickly in the same group gets temporary refusals. Plan a queue and a pause between two messages.

  • Sends that are too close together can be refused for a while: space them out and handle the error.
  • A bot that keeps a long history in memory uses RAM: store that data in a database instead.
  • The free plan gives 315 MB of RAM: enough for a command bot, less for a bot that processes large files.

Why host a Telegram bot with ACLClouds

A Telegram bot is a light process, well suited to the free plan. Write it in Node.js or Python, then upload it over SFTP on port 2222.

  • Free plan: 1 bot, 315 MB of RAM, 0.25 vCPU, 715 MB of storage, 4 days, renewable for free.
  • SFTP access per bot on port 2222, to upload your code.
  • The Node.js and Python images include ffmpeg, yt-dlp and deno.

Frequently asked questions

Does a Telegram bot use a lot of RAM?

For simple commands, no. Data kept in memory and file processing are what push consumption up. Measure it for a week before drawing conclusions.

Can the bot run without a webhook?

Yes. Polling is enough for most bots and needs no public address.

Which language should I choose?

Node.js and Python are the two languages offered for bots on ACLClouds. Pick the one you know: both are enough for a Telegram bot.