WEBAPP_HOST在Web挂钩中是什么?

huangapple go评论54阅读模式
英文:

What is WEBAPP_HOST in web hook?

问题

You should enter the hostname or IP address where your web application will be hosted. In this case, since you are deploying a Telegram bot, you would typically deploy it on a server or hosting platform. You should enter the hostname or IP address of that server. If you are running the bot locally for testing, then "localhost" would be appropriate. However, when deploying it for production use, you would need to provide the actual server's hostname or IP address where your bot's webhooks will be accessible.

英文:

I'm trying to deploy my Telegram Bot on hosting. The bot was written in python, aiogram.
Firstly, for a test I tried to deploy simple echo bot.
According to aiogram docs:

WEBHOOK_HOST = 'https://your.domain'    # Here I entered my domain
WEBHOOK_PATH = f'/{API_TOKEN}'
WEBHOOK_URL = f"{WEBHOOK_HOST}{WEBHOOK_PATH}"

# webserver settings
WEBAPP_HOST = 'localhost'  # THIS IS QUESTION, I do not know what to enter here.
WEBAPP_PORT = 3001

I do not know what to enter to WEBAPP_HOST. I tried enter "localhost", "0.0.0.0", site's domain, and site's ip address, but none of them worked.
What should I write there?

答案1

得分: 0

这是您托管脚本的 Web 服务器的完全限定域名(FQDN),您已将其设置为 Webhook。

因此,如果您的 Webhook 脚本托管在 https://example.com/telegram/webhook.py 上,您将需要以下设置:

WEBHOOK_HOST = 'https://example.com'
WEBHOOK_PATH = '/telegram/webhook.py'
WEBHOOK_URL = f"{WEBHOOK_HOST}{WEBHOOK_PATH}"
英文:

It's the FQDN of your webserver where you host the script that you've set up as the webhook.

So if your webhook script is hosted on https://example.com/telegram/webhook.py, you'll need the following settings:

WEBHOOK_HOST = 'https://example.com'
WEBHOOK_PATH = '/telegram/webhook.py'
WEBHOOK_URL = f"{WEBHOOK_HOST}{WEBHOOK_PATH}"

huangapple
  • 本文由 发表于 2023年5月14日 04:11:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76244687.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定