'Telegram bot and the method getUpdates

I have a question about Telegram bot, I created a bot some weeks ago, it works fine but there is a strange behavior with the method getUpdates; indeed if I use the link:

https://api.telegram.org/bot<token>/getUpdates

now I can't see any message, but if I start a new bot this link works fine like the first day when I created the other bot.

There is a particular interval of time after which this link stops working? There is a way to re-enable it?

Thanks in advance



Solution 1:[1]

From Telegram Bot API documentations:

Incoming updates are stored on the server until the bot receives them ... but they will not be kept longer than 24 hours.

So, getUpdates did not stop working. Old messages got deleted after a finite amount of time.

Solution 2:[2]

Use @BOtFather And /revoke command to Get New Token for your bot.

Solution 3:[3]

I had an issue with my bot API were it mysteriously crashes. I found it was due to it returning this HTML page instead of a JSON string very rarely. Even though the getUpdates interval was a fair 3 seconds. I've patched an update not long ago.

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.10.1</center>
</body>
</html>

The only time the bot token becomes useless is when it's been manually /revoke on BotFather on the target bot.

If you still having issues. You could try my TelegramBot class that uses the getUpdates method that should be easy to use. I have no issues running my bot on Android and Windows 10 Node.js servers. https://github.com/NightfallAlicorn/telegrambot-nodejs-getupdates Be aware it's not 100% complete but it's stable and has all functionalities except inline bot stuff.

Solution 4:[4]

It can happen if someone get updates already. Maybe your bot is running somewhere. I also had this problem when the bot was not running for me, but something still received these updates. I think it will help you to get a new access token via /revoke in @BotFather, after that everything work good in my case.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nick Lee
Solution 2 Mehdi jafari
Solution 3 Nova
Solution 4 S__