telegram-bot-sdk
telegram-bot-sdk copied to clipboard
Ability to use named route instead of webhook url
Hello!
Currently configuration requires to put full webhook url into webhook_url key like this:
'bots' => [
'MyBot' => [
'username' => env('TELEGRAM_USERNAME', ''),
'token' => env('TELEGRAM_TOKEN', ''),
'certificate_path' => env('TELEGRAM_CERTIFICATE_PATH', ''),
'webhook_url' => env('TELEGRAM_WEBHOOK_URL', ''),
'commands' => [
],
],
],
Maybe better way to set it this way? When webhook_route_name is set, webhook_url will be ignored.
Or we can validate value of webhook_url - if it is not valid URL try to pass it to secure_route() method.
'bots' => [
'MyBot' => [
'username' => env('TELEGRAM_USERNAME', ''),
'token' => env('TELEGRAM_TOKEN', ''),
'certificate_path' => env('TELEGRAM_CERTIFICATE_PATH', ''),
'webhook_url' => env('TELEGRAM_WEBHOOK_URL', ''),
'webhook_route_name' => 'telegram.webhook',
'commands' => [
],
],
],
Hey!
You can just use route('telegram.webhook')
and set the value for webhook_url
config.
We don't need another option.
I’m not able to use route inside config files because configs are loaded before container
'bots' => [
'MyBot' => [
'username' => env('TELEGRAM_USERNAME', ''),
'token' => env('TELEGRAM_TOKEN', ''),
'certificate_path' => env('TELEGRAM_CERTIFICATE_PATH', ''),
'webhook_url' => route('telegram.webhook'), // this line causes error
'commands' => [
],
],
],