telegram-bot-sdk icon indicating copy to clipboard operation
telegram-bot-sdk copied to clipboard

pending_update_count

Open karrarjasim opened this issue 6 years ago • 3 comments

how can i clear pending updates ? the resopnse of: https://api.telegram.org/bot<token>/getWebhookInfo give me pending_update_count:1560 !!!

karrarjasim avatar Aug 13 '18 20:08 karrarjasim

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

welcome[bot] avatar Aug 13 '18 20:08 welcome[bot]

I don't know best practice of this issue, but usually I just do delete the webhook and set it again to my endpoint

  1. https://api.telegram.org/bot/deleteWebhook.
  2. https://api.telegram.org/bot/setWebhook?url=https://example.com/api/ (as mentioned in https://core.telegram.org/bots/api#setwebhook).

Just make sure your code don't have any errors, because Telegram server will keep trying to send the exact message to your webhook URL and make the pending count keep increasing.

yongkyali avatar Oct 03 '18 12:10 yongkyali

You can clear pending_update_count by setting drop_pending_updates=True to clear pending_update_count.

  1. https://api.telegram.org/bot/setWebhook?url='https://example.com"&drop_pending_updates=True
  2. https://api.telegram.org/bot/deleteWebhook?drop_pending_updates=True

These two methods will be able to clear the pending_update_count.

zhenyang0405 avatar Oct 11 '21 15:10 zhenyang0405