I’m trying to delete messages from /getUpdates in telegram API but I didn’t know how.. I tried to use /deleteMessage
https://api.telegram.org/bot<TOKEN>/deleteMessage?chat_id=blahblah&message_id=BlahBlah
But it didn’t delete message from API database..
Advertisement
Answer
TL;DR: Call getUpdates()
with the offset
parameter set to the last message’s id, incremented by 1
We’ll need to let Telegram know which message’s we’ve processed. To do this, set the offset
parameter to the update_id + 1
of the last message your script has processed.
Call
getUpdates()
to get theupdate_id
of the latest messagehttps://api.telegram.org/<MY-TOKEN>/getUpdates
{ "ok": true, "result": [ { "update_id": 343126593, # <-- Remember / Save this id "message": { ...
Increment the
update_id
by1
On the next
getUpdates()
call, set theoffset
parameter to the id:https://api.telegram.org/<MY-TOKEN>/getUpdates?offset=343126594