telegram-bot-sdk
telegram-bot-sdk copied to clipboard
pending_update_count
how can i clear pending updates ?
the resopnse of: https://api.telegram.org/bot<token>/getWebhookInfo
give me pending_update_count:1560 !!!
👋 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.
I don't know best practice of this issue, but usually I just do delete the webhook and set it again to my endpoint
- https://api.telegram.org/bot
/deleteWebhook. - 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.
You can clear pending_update_count by setting drop_pending_updates=True to clear pending_update_count.
- https://api.telegram.org/bot/setWebhook?url='https://example.com"&drop_pending_updates=True
- https://api.telegram.org/bot/deleteWebhook?drop_pending_updates=True
These two methods will be able to clear the pending_update_count.