| Mode | Needs | Good hosts | Watch out |
|---|---|---|---|
| Long polling | A process that never sleeps; no public URL | Railway, Vultr, Fly.io | Only one poller per token |
| Webhook | Public HTTPS URL, fast response | Cloudflare Workers, Railway, a VPS with TLS | Verify the secret token header |
Switching from polling to webhook
- Deploy the webhook build and confirm /healthz responds.
- Call setWebhook with secret_token; Telegram then stops delivering to getUpdates.
- Stop the old polling process.
Build the setWebhook URL with the Telegram URL builder and send a test with the Telegram/Discord webhook tester.
Related guides and tools
- Free hosting for Telegram bots
- Best hosting for Telegram bots
- Telegram/Discord webhook tester
- Cheapest always-on bot hosting
- PaaS vs VPS for bots
Frequently asked questions
Which is faster?
Both deliver updates quickly in practice; webhooks avoid the open connection.
Can I test webhooks locally?
Use a tunnel or our webhook inspector to see the request, or keep polling for development.
Why do I get 409 Conflict?
A webhook is set while you call getUpdates, or two pollers run. Delete the webhook or stop the duplicate.