Answer the question
In order to leave comments, you need to log in
How to get result in getUpdates Telegram API method?
Good afternoon.
I'm trying to get data using the getUpdates Telegram API method - I found this guide.
I write to my bot - t1Bot
Then I use the method:
import requests
BOT_TOKEN = '132176590:AAE2dUVDjj9epTIIe6KIYtlvvmnc1S-YHSM'
MethodGetUpdates = 'https://api.telegram.org/bot{token}/getUpdates'.format(token=BOT_TOKEN)
while True:
response = requests.post(MethodGetUpdates)
result = response.json()
print result
Answer the question
In order to leave comments, you need to log in
What do you write to him and where? If in a group, then by default it accepts messages starting with / and where the name of the bot is mentioned. To accept all text /setprivacy disabled do with BotFather
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?...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question