Forums

aiogram webhook

Hello, I can't figure out how to set up a webhook on aiogram... When launched with ngrok, the bot worked if you specify the port from which the tunnel started for the webhook. I have seen a lot of explanations for Flask applications, but I'm interested in how to solve the problem using aiogram. As far as I understand, the error is that when I run executor.start_webhook(...), it tries to create(?) the server itself, while the server already exists. Please tell me how to deploy the telegram bot on aiogram. I used to just run long_poling but due to the fact that consoles are not supported here for more than 24 hours, this cannot be done, as I understand it

Can you show the error you're getting?

If I select the port on which I understand the server is running (eg 5000), I get an error:

OSError: [Errno 98] error while attempting to bind on address ('127.0.0.1', 5000): address already in use.

If I choose a different port (for example, 3001), then the bot starts successfully, but does not respond to my messages. That is, it does not receive updates from this port.

Right -- you will not be able to start a server like this on PythonAnywhere. To use webhooks, you need a web app, but async is not currently supported in our web apps.

Thanks a lot for your answer