I want to clear all pending_update_count
in my bot!
The output of below command :
https://api.telegram.org/botxxxxxxxxxxxxxxxx/getWebhoo
I think you have two options:
Update:
Problem with webhook on your side. You can try to emulate telegram's POST query on your URL. It can be something like this:
{"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"}
You can send this text as a POST query body with PostMan for example, and after it try to debug your backend.
I solved is like this
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
doing this serveral times
POST tg.api/bottoken/getWebhookInfo
had a look if all away.
POST tg.api/bottoken/setWebhook with filled "url"
For anyone looking at this in 2020 and beyond, the Telegram API now supports clearing the pending messages via a drop_pending_updates
parameter in both setWebhook
and deleteWebhook
, as per the API documentation.
i solve it by Change file access permissions file - set permissions file to 755
and second increase memory limit in php.ini file
Just add return 1;
at the end of your hook method.
Update:
Commonly this happens because of queries delay with the database.