Telegram bots: polling or webhook?
A Telegram bot receives updates in one of two ways. Both work on FadeHost; which one to pick depends on whether the bot is also a web app.
Polling
The bot asks Telegram for new updates in a loop (getUpdates). Every library does it with one call: dp.start_polling(bot) in aiogram, app.run_polling() in python-telegram-bot, bot.start() in grammY, bot.launch() in Telegraf.
- Needs nothing: no port, no address, no certificate.
- Works on the free tier and on any paid tier.
- Handles a restart cleanly: Telegram keeps updates for 24 hours and hands them over when the bot comes back.
For a bot that is only a bot, this is the answer.
Webhook
Telegram calls your bot at an https URL for every update. The bot is then a web server listening on 0.0.0.0 and the PORT the panel sets, and it needs a public https address.
- Hosted apps can have one:
https://name.fadehost.appfrom the app’s page. - On the free tier that address sleeps when idle and wakes on the next request, so the first update after a quiet period is slower and Telegram may retry it. A paid app’s address stays up.
- Set it once after deploy:
curl "https://api.telegram.org/bot<TOKEN>/setWebhook?url=https://name.fadehost.app/webhook", or with your library’s helper.
Use a webhook when the bot is part of a larger web app anyway, or when you need Telegram to reach a route that also serves a site.
Switching
Telegram allows one mode at a time. Before polling again, delete the webhook (deleteWebhook), or polling answers Conflict: can't use getUpdates method while webhook is active. The same conflict appears when two copies of the bot poll at once, for example a copy still running on your machine while the hosted one starts.
Which one, in short
| You have | Use |
|---|---|
| A bot, free tier | Polling |
| A bot, paid tier | Polling, unless you want a web page too |
| A bot inside a web app with an address that stays up | Webhook |