Telegram Bot Webhook Not Working? Read getWebhookInfo and Fix the Error (2026)

By · Published 2026-10-31 · Last verified 2026-10-31

Why is my Telegram bot webhook not working?

Usually because Telegram can't deliver to your URL, and it tells you why if you ask. The Bot API method getWebhookInfo returns the webhook URL Telegram has on file, how many updates are waiting (pending_update_count), and the time and text of the most recent delivery error (last_error_date and last_error_message). Those three fields answer most "my bot stopped responding" questions in under a minute. This guide shows how to read them, what the common error messages point to, and the order we use to fix a webhook without losing updates. It's the same routine we use for the Auto X Telegram bot, which schedules X posts from Telegram and depends on every update arriving once.

If your bot uses getUpdates polling instead of a webhook and you see a 409 error, that's a different problem; see how to fix a Telegram bot 409 Conflict.

Step 1: call getWebhookInfo

Open https://api.telegram.org/bot<token>/getWebhookInfo from a trusted machine, or call it from your code, and keep the token out of logs and screenshots. The response is a WebhookInfo object. The fields that matter most:

Grid of six getWebhookInfo fields to read: url, pending_update_count, last_error_message, last_error_date, max_connections from 1 to 100 with default 40, and allowed_updates
Fields to read first.

Step 2: match the error to a cause

The wording of last_error_message varies, but it usually falls into one of five groups:

Grid matching webhook errors to causes: SSL and TLS 1.2, wrong port, IPv4 only, server errors, secret token mismatch and firewalls blocking Telegram's subnets
Match the error to a cause.

Step 3: fix it in an order that keeps your updates

Telegram stores incoming updates until the bot receives them, but not for longer than 24 hours. That gives you a window to fix things without losing messages, as long as you don't throw the queue away by accident.

  1. Fix the endpoint first. Make the URL return 200 to a test POST from outside your network, with a valid certificate chain.
  2. Re-set the webhook if anything changed, such as the domain, path, port or secret. Call setWebhook with the same allowed_updates you used before.
  3. Leave drop_pending_updates off unless you really want to discard the backlog. Setting it to true clears everything waiting.
  4. Watch pending_update_count fall on the next getWebhookInfo calls, and check that last_error_date stops moving.

When the backlog arrives, it can come in a burst. Deduplicate by update_id so a retried delivery doesn't schedule the same post twice; our guide to webhook secret tokens and update_id dedupe shows the pattern.

Four steps to fix a webhook without losing updates: read the error, fix the certificate, port or handler, set the webhook again and watch the pending count fall
Fix order.

Why a bot answers some messages and not others

If deliveries succeed but some messages never reach your handler, the webhook is fine and the filter is the problem. allowed_updates from your last setWebhook call stays in force until you change it, so a bot that once asked only for message won't receive callback_query updates from inline buttons. In groups, privacy mode also limits which messages a bot sees. Compare the allowed_updates list in getWebhookInfo with the update types your code expects.

Two columns comparing staying on a webhook with a secret token header against switching to getUpdates after deleteWebhook with one polling process
Pick one method.

Monitoring so it doesn't happen silently again

A webhook can break overnight after a certificate renewal, a proxy change or a deploy that moves a route. A cheap safeguard is a scheduled job that calls getWebhookInfo every few minutes and alerts you when pending_update_count keeps rising or last_error_date is recent. Keep the alert message short: the error text, the pending count and the time. For a scheduler like Auto X, pair this with retry and dead-letter handling on the X side, so a failed publish is visible instead of lost; see retries and dead-letter queues for Telegram-to-X publishing.

If your scheduled X posts didn't go out and the webhook looks healthy, the cause is probably further down the chain. Our checklist of why a scheduled post didn't post on X covers the other common causes.

Vertical Pinterest graphic with five points for fixing a Telegram bot webhook
Pinterest pin: Telegram webhook not working.

After the fix: webhook or getUpdates?

Telegram gives a bot two ways to receive updates, and you can only use one at a time. The Bot API states that getUpdates won't work while an outgoing webhook is set, so a bot that switches between them during debugging often ends up in a confusing half-state. Decide on one and make the deploy enforce it.

Whichever you pick, write the choice into your deploy notes, along with the webhook URL, the allowed update types and who owns the token. The next person debugging the bot, often future you, will save an hour.

FAQ

How do I check whether my Telegram bot has a webhook set?

Call getWebhookInfo. If the url field is empty, no webhook is set and the bot must use getUpdates. If it has a URL, Telegram posts updates there.

How long does Telegram keep updates if my webhook is down?

The Bot API documentation says incoming updates are stored until the bot receives them, but not for longer than 24 hours.

Which ports can a Telegram webhook use?

Ports 443, 80, 88 and 8443. Other ports aren't supported, so a reverse proxy usually forwards one of them to your app.

Will deleting the webhook lose my pending updates?

Not by default. deleteWebhook and setWebhook only drop the backlog when you pass drop_pending_updates set to true.

Why does pending_update_count keep growing?

Telegram is trying to deliver and failing, or your handler doesn't answer with a success status. Read last_error_message for the reason and fix the endpoint first.

Sources