skip to Main Content

I’m adapting my Telegram bot to accept webhooks requests instead of doing constant polling, so I read the Telegram API documentation about the setWebhook method.

I’m using Python’s micro-framework Flask to create my web application that receives the request.

Somewhere in the documentation it says "In case of an unsuccessful request, we will give up after a reasonable amount of attempts.". What does it mean? Do I have to return something specific in my @app.route decorator so the API understand I got what I wanted? I don’t have much knowledge on web application so I have no idea how to say "hey I got what you sent".

2

Answers


  1. It means if it fails to send the update (for example if your webhook is down). You don’t have to return anything, you just need your webhook to be active by the time.

    Login or Signup to reply.
  2. The Webhook approach allows Telegram to push the messages to your backend.
    The Webhook should normally always be online, but if it is down the message (on Telegram side) is queued for a while.

    This works nicely when your Flask app needs some time, for example, to startup.

    Note the message is delivered once: if the Webhook fails (backend error) and return an error text or http status code (403) the message is consumed and will not be re-sent.

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