#### [Examples](../README.md) ## Bashtbot webhook examples ### webhooks Bashbot default mode is to poll Telegram server for updates. Telegram offers the more efficient webhook method to deliver updates. If your server is reachable from the Internet, you can use the webhook method described here (experimental), instead of running bashbot with `bashbot.sh start` #### Setup webhook To get updates with webhooks your server must be reachable from the internet and you must inform Telegram about where to deliver updates, this will be done by calling `set_webhook URL`. For security reasons bashbot adds you bottoken to the URL. *Example:* ```bash bin/any_command.sh set_webhook "https://myserver.com/telegram" ``` will instruct Telegram to use the URL `https://myserver.com/telegram//` to deliver updates. After you setup webhook to deliver updates it's no more possible to poll updates with `bashbot.sh start`. To stop delivering of updates with webhook run `bin/any_command.sh delete_webhook` **Important**: Only https connections with a valid certificate chain are allowed as endpoint for webhook. #### Using Apache with php enabled If you have an Apache webserver with a valid SLL certificate chain and php running you can use it as webhook endpoint: - setup bashbot to run as the same user as your web server (_`bashbot.sh init`_) - create the directory `telegram/` in webserver root - copy `index.php` into new directory - edit `index.php` to point to your bashbot installation - setup webhook for your server (_e.g. `bin/any_command.sh set_webhook "https://myserver.com/telegram`_) - send a command to your bot (_e.g. `/start`_) to check correct setup *Example index.php*, see [index.php](index.php) for a more complete implementation. ```php ``` #### $$VERSION$$ v1.40-dev-12-ga289cb8