I have read some documents to understand the webhook configuration for getting the latest user send messages from bot added telegram group the documents and the links are this , this, this , telegram api doc and telegram bot doc
I understand the concept but I’m getting the confusion on configuration of webhook url to get the latest messages and where should I configure this webhook url.
Note :- Should configure this webhook url in our server(www.example.com)?
Example webhook url is :
https://api.telegram.org/bot{my_bot_token}/setWebhook?url={url_to_send_updates_to}
Suggest me how to work with telegram webhook. And get the latest user send messages.
2
Answers
You need to set Webhook on your own static web address, for instance:
There should be POST-handler on this route, that way Telegram’s updates can be received.
You must set your webhook manually.
You’ve got a
bot_token
and you know which url will receive the POST updateswebhook_url
You run this link in your browser with your configuration:
After that any update will be send to your webhook url as a JSON
If you got an error
429: Too Many Requests
, you must handle this in your code.It comes because you are sending to many requests to the Bot API, and every bot has a limit
30 request/second
.So try to minimize requests as much as possible in your code and do some
Thead.Wait()
if needed