S
S
samarkad332015-11-27 14:55:18
Telegram
samarkad33, 2015-11-27 14:55:18

Why does Telegram's getUpdates return []?

I am writing a telegram bot. I send messages, they are delivered normally, sendMessage returns the data. And here getUpdates - does not want in any way. There is no error, it just returns [].
{"ok":true,"result":[]}
The code is large, in the repository, so I can't post it here.
What could be the reason?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
L
Lynatik001, 2020-07-27
@Lynatik001

I will give the answer to the future people that finds this topic in Google. - An empty array due to the fact that the bot is enabled, it has time to process unviewed messages before you write something to the bot, and return to the browser to see if there is anything in the array. Duck that the bot must be off before you watch anything

N
Nikolai Pinevich, 2017-02-07
@Afres

This method returns only new messages. If the bot has already responded to some messages sent to it, then it has already received them (most likely by the same method) and they are marked as received by the Telegram server. Accordingly, they will no longer be returned with each new request, otherwise you would receive the entire message history every time since the bot was created. In this case, you have two options:
Keep a log of messages received by the bot and use it at your discretion.
Play around with the offset parameter of the getUpdates method. More details here: https://core.telegram.org/bots/api#getupdates
For example: https://api.telegram.org/botXXXXXXXXXX/getUpdates?...

M
Mr4x, 2016-03-17
@Maxim_Samburskiy

It looks like there are no updates, try to look through the browser https://api.telegram.org/bot<token>/getUpdatesif the result is the same, then your messages simply do not reach the server

K
KirillHamann, 2021-01-13
@KirillHamann

Correctly Lynatik001 wrote! I myself suffered with this problem. The answer comes, that is, the bot works and receives messages, but the result is empty! I suffered for a long time 3 years ago and somehow it turned out. And now I really tried it - go to the cart, find our bot and write /stop to it. Everything, we repeat the procedure with the result - everything works. Then again we go to the bot and start it / start.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question