skip to Main Content

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


  1. You need to set Webhook on your own static web address, for instance:

    https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/setWebhook?url=https://www.example.com
    

    There should be POST-handler on this route, that way Telegram’s updates can be received.

    Login or Signup to reply.
  2. You must set your webhook manually.
    You’ve got a bot_token and you know which url will receive the POST updates webhook_url

    You run this link in your browser with your configuration:

    https://api.telegram.org/bot{bot_token}/setWebhook?url={webhook_url}
    

    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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search