Clear "pending_update_count" in Bot telegram

I want to delete everything pending_update_countin my bot!

The output of the command is below:

https://api.telegram.org/botxxxxxxxxxxxxxxxx/getWebhookInfo

Obviously, I replaced the real API token with xxx

:

{
 "ok":true,"result":
    {
     "url":"",
     "has_custom_certificate":false,
     "pending_update_count":5154
    }
}

As you can see, I have 5154unread til now! Updates (I am sure that pending updates are errors! Because no one uses this Bot! This is just a test bot)

By the way, this number is pending_update_countgrowing so fast! Now, when I write this post, the number has increased 51and reached 5205!

I just want to clear these pending updates. I'm sure this Bot is stuck in an endless loop!

Is there any way to get rid of it?

PS:

I also cleared the webhook url. But nothing has changed!

UPDATE:

The conclusion getWebhookInfois:

{
   "ok":true,
   "result":{
      "url":"https://somewhere.com/telegram/webhook",
      "has_custom_certificate":false,
      "pending_update_count":23,
      "last_error_date":1482910173,
      "last_error_message":"Wrong response from the webhook: 500 Internal Server Error",
      "max_connections":40
   }
}

Why am I getting Wrong response from the webhook: 500 Internal Server Error?

+8
3

, :

  • webhook, , 200 OK . Telegram wiil URL-, .
  • webhook getUpdates webhook

Update:

webhook . POST- URL-. :

{"message_id":1,"from":{"id":1,"first_name":"FirstName","last_name":"LastName","username":"username"},"chat":{"id":1,"first_name":"FirstName","last_name":"LastName","username":"username","type":"private"},"date":1460957457,"text":"test message"}

POST PostMan, .

+6

return 1; .

:

- .

+2

POST tg.api/bottoken/setWebhook to emtpy "url"
POST tg.api/bottoken/getUpdates
POST tg.api/bottoken/getUpdates with "offset" last update_id appeared before

POST tg.api/bottoken/getWebhookInfo

.

POST tg.api/bottoken/setWebhook with filled "url"
0
source

Source: https://habr.com/ru/post/1665017/


All Articles