irazasyed / telegram-bot-sdk

🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
https://telegram-bot-sdk.com
BSD 3-Clause "New" or "Revised" License
3.04k stars 671 forks source link

[Bug]: HTTP webhooks are prohibited, but they are allowed in case of using own bot api server #1137

Open glukinho opened 2 months ago

glukinho commented 2 months ago

PHP version

8.3.10

irazasyed/telegram-bot-sdk version

v3.14.0

Laravel version (if any)

v11.21.0

Code To Reproduce the bug

I'm using Laravel base_bot_url in telegram.php set to: 'http://127.0.0.1:8081/bot' because I'm using my own bot API server launched on the same host.

I execute in Tinker:

$webhook_url = 'http://127.0.0.1/api/telegram/my_bot/webhook';
Telegram::bot('my_bot')->setWebhook(['url' => $webhook_url]);

This code gives: Telegram\Bot\Exceptions\TelegramSDKException Invalid URL, should be a HTTPS url. If I manually set webhook to URL http://127.0.0.1/api/telegram/my_bot/webhook using Telegram Bot API (with CURL for example), everything works fine. I think HTTP webhooks shouldn't be prohibited because they definitely may exist in Telegram.

Error stacktrace (if any)

No response