deepeloper / tunneled-webhooks
Tunneled Webhooks
Installs: 34
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=8.2
- ext-json: *
- irazasyed/telegram-bot-sdk: ^3.13
- jfcherng/php-color-output: *
Requires (Dev)
README
Runs tunneling service and registers temporary webhooks for workstation having no white IP by one command /path/to/php bin/run.php /path/to/config.php
.
- Implemented tunneling services: ngrok;
- Implemented webhooks connectors: Telegram;
- Implemented bots: Windbag.
You can add your own tunneling services, register and handle your own webhooks.
Compatibility
Installation
composer require deepeloper/tunneled-webhooks
Tunneling services
Download ngrok (and/or other tunneling services), sign up in service, get auth token and run service once /path/to/ngrok authtoken %YOUR_NGROCK_AUTH_TOKEN%
.
Webhooks
Register Telegram bot and receive bot auth token.
Configuring local web server
- nginx
Add *.ngrok.io subdomains:
server {
listen 127.0.0.1:80;
server_name ~^(.*)\.ngrok\.io;
; This application www-directory
root /path/to/www;
}
and restart nginx.
- Apache
According to ngrok docs in own config modify
«service/command» value as /path/to/ngrok http --host-header=%LOCAL_HOST_NAME% 80
.
Application config
Copy «config.skeleton.php» to your own config file and put ngrok path & Telegram token to the new file:
// ... 'service' => [ 'class' => "\\deepeloper\\TunneledWebhooks\\Service\Ngrok", // CLI command to run service. // Modify path here: 'command' => "/path/to/ngrok http 80", // ... ], 'webhook' => [ 'Telegram' => [ 'Windbag' => [ // ... // Telegram bot token. // Modify token here: 'token' => "", // ...
Usage
Run tunneling service and bot
vendor/bin/tunneled-webhooks /path/to/config.php
Tunneling service will be started, Telegram webhook will be registered, and you could to start conversation with Telegram bot.
Run bot from CLI
vendor/bin/bot.windbag