Comparison

Webhook vs long polling: how it changes where you host a bot

The delivery mode decides half of your hosting choice.

Comparison2 min readUpdated

ModeNeedsGood hostsWatch out
Long pollingA process that never sleeps; no public URLRailway, Vultr, Fly.ioOnly one poller per token
WebhookPublic HTTPS URL, fast responseCloudflare Workers, Railway, a VPS with TLSVerify the secret token header

Switching from polling to webhook

  1. Deploy the webhook build and confirm /healthz responds.
  2. Call setWebhook with secret_token; Telegram then stops delivering to getUpdates.
  3. Stop the old polling process.

Build the setWebhook URL with the Telegram URL builder and send a test with the Telegram/Discord webhook tester.

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.