M
M
milleniumilya2018-03-21 13:14:32
Bots
milleniumilya, 2018-03-21 13:14:32

How to defeat the 404 error when setting a webhook for a bot in Telegram?

There is a bot hosted on timeweb, a free Let's Encrypt certificate has been received on the hosting itself. Setwebhook succeeds:
Webhook was set
although I guess this message does not guarantee successful installation of the webhook.
If you check for updates via getUpdates (before Setwebhook of course), then all updates come normally. But after installing the webhook, there was silence in response from Telegram.
getWebhookInfo says that

"url":"https://тут мой url.index.php",
"has_custom_certificate":false,
"pending_update_count":17,
"last_error_date":1511886170,
"last_error_message":"Wrong response from the webhook: 404 Not Found",
"max_connections":40.

Certificate tested on https://www.ssllabs.com/ssltest/analyze.html with success.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nezaicev, 2019-07-08
@nezaicev

The POST request is sent to a non-existent url. Most likely you need to add a token to the domain.
In Django:

urlpatterns = [
    path(token+'/', test, name='test')
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question