Skip to main content
Share
Guides

pending_update_count in getWebhookInfo: What the Number Means

getWebhookInfo returns pending_update_count as a plain integer because it is a queue depth - the number of updates Telegram is holding because your webhook did not accept them. How to read it alongside last_error_message, why it grows, how to clear it, and the 24-hour ceiling that makes a climbing count urgent.

Content & Engineering
Sep 4, 2026
9 min read
Last verified September 2026
pending_update_countgetwebhookinfotelegram bot api pending_update_counttelegram webhook backlogdrop_pending_updates
TL;DR

getWebhookInfo returns pending_update_count as a plain integer because it is a queue depth - the number of updates Telegram is holding because your webhook did not accept them. How to read it alongside last_error_message, why it grows, how to clear it, and the 24-hour ceiling that makes a climbing count urgent.

Key Takeaways
  • pending_update_count is one field in the object getWebhookInfo returns, and Telegram's documentation defines it in five words: "Number of updates awaiting delivery" .
  • It is an integer because it is a queue depth - not a status, not an error code, not a flag.
  • If you were expecting an object or a list, that is the whole answer: the API is telling you how many updates Telegram is currently holding because it has not been able to hand them to your bot.
  • curl "https://api.telegram.org/bot<TOKEN>/getWebhookInfo" { "ok": true, "result": { "url": "https://example.com/telegram", "has_custom_certificate": false, "pending_update_count": 37, "last_error_date": 1755590400, "last_error_message": "Wrong response from the webhook: 502 Bad Gateway", "max_connections": 40 } } A count of 0 is what a healthy bot looks like: Telegram delivered everything and nothing is waiting.

What pending_update_count actually is

pending_update_count is one field in the object getWebhookInfo returns, and Telegram's documentation defines it in five words: "Number of updates awaiting delivery". It is an integer because it is a queue depth - not a status, not an error code, not a flag. If you were expecting an object or a list, that is the whole answer: the API is telling you how many updates Telegram is currently holding because it has not been able to hand them to your bot.

curl "https://api.telegram.org/bot<TOKEN>/getWebhookInfo"

{
  "ok": true,
  "result": {
    "url": "https://example.com/telegram",
    "has_custom_certificate": false,
    "pending_update_count": 37,
    "last_error_date": 1755590400,
    "last_error_message": "Wrong response from the webhook: 502 Bad Gateway",
    "max_connections": 40
  }
}

A count of 0 is what a healthy bot looks like: Telegram delivered everything and nothing is waiting. Any other number means updates are queued right now. A single reading is close to meaningless, though - what matters is the direction. Call the endpoint twice, a minute apart.

  • Steady at 0 - nothing to fix.
  • Small and falling - you are draining a backlog after a blip. Leave it alone.
  • Climbing - your endpoint is failing or too slow, and every message a user sends is joining the queue.
  • Frozen at a high number - Telegram has most likely stopped retrying. See below.

Never read the count without last_error_message

The count tells you that delivery is failing. It never tells you why. The two fields beside it do, and Telegram defines them precisely: last_error_message is "Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook", and last_error_date is the Unix time of that error.

Read them together and the diagnosis is usually immediate:

  • Count climbing, last_error_message populated - your endpoint is answering, but wrongly. The message names the failure: a 502 means your app is down behind the proxy, a 500 means your handler threw, an SSL error means the certificate chain is incomplete for Telegram even if browsers accept it.
  • Count climbing, no error message - you are almost certainly returning 200 but too slowly, or you have two processes competing for the same bot.
  • Count high, last_error_date hours old - the failure has stopped being retried. Fix the endpoint, then re-check; nothing arrives until Telegram tries again.
  • Count 0 but no messages arriving - this is not a webhook problem at all. Telegram thinks it delivered them. Look at privacy mode in groups, or at your own routing after the request lands.

The single most common mistake is treating a non-zero count as the bug and restarting the app. The count is a symptom. The error message is the bug.

Why the number grows: what Telegram does when delivery fails

Telegram queues an update whenever your webhook does not accept it, and retries with backoff. The retries do not continue forever - after repeated failures over a period of hours Telegram gives up on that webhook, which is why a count that was climbing can sit frozen while last_error_date stays stuck in the past.

There is a hard ceiling on the whole thing. Telegram's documentation states that "Incoming updates are stored on the server until the bot receives them either way, but they will not be kept longer than 24 hours." That sentence has a consequence people discover the expensive way: a backlog is not preserved indefinitely while you debug over a weekend. Anything older than 24 hours is gone, and no amount of fixing your endpoint brings it back. If the queued updates matter - orders, form answers, support requests - the clock is the reason to treat a climbing count as urgent rather than cosmetic.

The realistic causes, in the order they actually occur:

  1. The endpoint is returning a non-2xx. Telegram wants a 200 quickly; anything else is a failed delivery.
  2. The endpoint is too slow. Doing the work before responding is the classic error. Acknowledge with 200 immediately, then process the update on a queue.
  3. The certificate is incomplete. Telegram is stricter than a browser about intermediate certificates.
  4. The URL is stale. A redeploy moved the host and nobody re-registered the webhook, so Telegram is faithfully queueing for an address that no longer exists.
  5. Two consumers. A polling process left running alongside the webhook, or a second deployment sharing the token - you will see a 409 conflict here.
  6. Throughput ceiling. max_connections "Defaults to 40"; on a genuinely high-volume bot the queue can build simply because you are not draining it fast enough.
Try it yourself
Build your first chatbot free
Free plan, no credit card required. Live on your site in about 10 minutes.
Start building free

How to clear the backlog (and when not to)

You can discard the queue outright. Telegram exposes it as a parameter on two methods, documented identically as "Pass True to drop all pending updates":

# Drop the queue and remove the webhook (switching back to getUpdates)
curl "https://api.telegram.org/bot<TOKEN>/deleteWebhook?drop_pending_updates=true"

# Or re-register the webhook and drop the queue in the same call
curl -X POST "https://api.telegram.org/bot<TOKEN>/setWebhook" \
  -d "url=https://example.com/telegram" \
  -d "drop_pending_updates=true"

Be clear about what this does: it deletes user messages your bot never processed. That is the right call when the queue is test traffic, or a flood you have no intention of replaying, or when a stale backlog would make your bot reply to hours-old conversations the moment it recovers - which reads as broken to the user on the other end.

It is the wrong call when those updates are real work. Fix the endpoint first and let Telegram deliver the queue normally; it will, as long as you are inside the 24-hour window. Dropping first because the number is unsightly is how people lose orders.

Note the asymmetry worth knowing: there is no method that clears the queue while leaving the webhook untouched. Both routes change the webhook registration as well - one removes it, one re-sets it.

The fix, in order

Work down this list; each step is cheap and rules out the one below it.

  1. Read the whole getWebhookInfo response, not just the count. The error message names the fault most of the time.
  2. Call your own webhook URL from outside your network with a POST and a JSON body. If you cannot get a fast 200 from the public internet, neither can Telegram.
  3. Return 200 before doing the work. Acknowledge, enqueue, process. This alone fixes most slow-endpoint backlogs.
  4. Check the certificate chain with an external SSL checker rather than a browser.
  5. Confirm the registered URL is the one you are running - compare the url field against your current deployment.
  6. Make sure nothing else is consuming the bot - one webhook or one poller, never both.
  7. Re-check the count after the fix. It should fall on its own. If it does not move and last_error_date is stale, re-register the webhook to prompt Telegram to resume.
  8. Only then consider dropping, and only if you have decided the queued updates are expendable.

If the count is 0 and messages still are not arriving, the problem is elsewhere - our Telegram bot not responding guide covers privacy mode, 409 conflicts and the causes that sit outside webhook delivery, and the Telegram error code reference lists the literal API messages with their fixes.

Telegram Bot Token Checker
Free tool - no signup, runs in your browser.
Open free tool

Monitoring it so you find out before your users do

Every bot that matters should poll getWebhookInfo on a schedule - once a minute is plenty - and alert on two conditions: pending_update_count above a threshold you have picked deliberately, and any change in last_error_date. The second is the more valuable alarm, because it fires on the first failed delivery rather than after a queue has built.

Pick the threshold from your own traffic. A bot handling thousands of messages an hour can show a transient count in the dozens and be perfectly healthy; a quiet internal bot sitting at 15 has been broken for a while. The absolute number means nothing without your baseline - which is the reason to record it continuously rather than check it during an incident.

The 24-hour ceiling is what turns this from hygiene into something worth paging on. An unmonitored webhook that fails on a Friday evening has silently discarded a day of customer messages by Saturday night, and nothing in your logs will ever show what they said. Related reading: the cross-platform webhook debugging guide for the same failure shapes on Meta, Slack and Discord.

Share this article:

Was this article helpful?

Ready to build your chatbot?

Join the businesses. Deploy on website, WhatsApp, and 11 more channels in minutes. Free forever plan available.

No credit cardNo coding13+ channels
Start Building Free

Get chatbot insights delivered weekly

Join 5,000+ professionals getting actionable AI chatbot strategies, industry benchmarks, and product updates.

🎯Automate this with a free chatbot

Build and deploy in 10 minutes. No coding needed.

FAQ

pending_update_count in getWebhookInfo FAQ

Everything you need to know about chatbots for pending_update_count in getwebhookinfo.

🔍
Popular:

It is the number of updates Telegram is holding because it has not been able to deliver them to your webhook. Telegram's documentation defines the field as "Number of updates awaiting delivery". It is an integer because it is a queue depth. Zero is healthy; a climbing number means your endpoint is failing or responding too slowly.

Because it is a count, not a status object. The field only ever reports how many updates are queued. The diagnostic detail lives in the two fields beside it - last_error_message, which gives the human-readable reason the most recent delivery failed, and last_error_date, the Unix timestamp of that failure. Read all three together.

Pass drop_pending_updates=true to either deleteWebhook or setWebhook - Telegram documents the parameter as "Pass True to drop all pending updates". Both change your webhook registration as a side effect; there is no method that empties the queue and leaves the webhook alone. Only do this once you have accepted that those messages are lost, because they are real user messages your bot never processed.

A maximum of 24 hours. The Bot API documentation states that incoming updates "will not be kept longer than 24 hours". So a backlog does not wait for you indefinitely - if your webhook is broken over a weekend, anything older than a day is permanently gone, and fixing the endpoint afterwards will not bring it back.

No. A small count that is falling just means you are draining a backlog after a brief interruption, and a busy bot can show a transient queue while being completely healthy. The signal is the trend, not the reading. Call getWebhookInfo twice a minute apart: falling is fine, climbing is a live fault, and frozen at a high number with a stale last_error_date usually means Telegram has stopped retrying.

A zero count means Telegram believes it delivered everything, so webhook delivery is not your problem. Look further along the chain: privacy mode stops a bot seeing ordinary group messages unless it is an admin or the message is a command or reply, a second process may be consuming updates, or your own routing may be dropping the request after it lands. The Telegram bot not responding guide walks through those causes.

About the Author

Content & Engineering

The Conferbot team writes about building, deploying, and improving AI chatbots.

View all articles
Skip the blank canvas
Start from one of 250+ free chatbot templates for lead generation, support, e-commerce, and 20+ industries - customize and launch in minutes.
Browse free templates

Related Articles

From the reference shelf

Fact-checked reference pages and free tools for the platform this article covers.

Omnichannel Platform

One Chatbot,
Every Channel

Your chatbot works seamlessly across WhatsApp, Messenger, Slack, and 6 more platforms. Build once, deploy everywhere.

View All Channels
Conferbot
online
Hi! How can I help you today?
I need pricing info
Conferbot
Active now
Welcome! What are you looking for?
Book a demo
Sure! Pick a time slot:
#support
Conferbot
New ticket from Sarah: "Can't access dashboard"
Auto-resolved. Password reset link sent.