我正在尝试使用 API 调用setWebhook
为我的Telegram bot
注册webhooks
。
我从ngrok
那里获得了本地服务器的公共HTTPS url,并将其传递给setWebhook
。
每当向我的机器人发送新消息时,我都会按预期收到对本地服务器的 POST 请求,但是,请求有效负载为空。
知道吗?
请编码。我在 Web 服务器上使用 curl 来设置 webhook。
干杯
编辑。我在我的wev服务器上使用了这个命令。可选的 SSL/TLS 证书。
curl -F "url=https://yourdomainname.com/mybot.php" -F "certificate=@/path/to/cert.pem" https://api.telegram.org/bot/setwebhook.php
希望对人有帮助!!
可以尝试使用
curl --location --request post 'https://api.telegram.org/bot/setWebhook'
--表单 'url="https://88c23dd3cc13.ngrok.io/"'
更新上述命令中的 ngrok URL