doc: xlink webhook example

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-02-01 12:58:57 +01:00
parent 737be16b3f
commit 3a29a9dc4a
6 changed files with 21 additions and 16 deletions

View File

@ -284,7 +284,8 @@ Written by Drew (@topkecleon) and Kay M (@gnadelwartz).
<li>Setup your environment</li> <li>Setup your environment</li>
<li>Bashbot test suite</li> <li>Bashbot test suite</li>
</ul></li> </ul></li>
<li><a href="examples/README.md">Examples Directory</a></li> <li><a href="examples">Examples Directory</a></li>
<li><a href="examples/webhook">Webhook Example</a></li>
</ul> </ul>
<h3>Your very first bashbot in a nutshell</h3> <h3>Your very first bashbot in a nutshell</h3>
<p>To install and run bashbot you need access to a Linux/Unix command line with bash, a <a href="https://telegram.org">Telegram client</a> and a mobile phone <a href="https://telegramguide.com/create-a-telegram-account/">with a Telegram account</a>.</p> <p>To install and run bashbot you need access to a Linux/Unix command line with bash, a <a href="https://telegram.org">Telegram client</a> and a mobile phone <a href="https://telegramguide.com/create-a-telegram-account/">with a Telegram account</a>.</p>

View File

@ -63,7 +63,8 @@ Bashbot [Documentation](https://github.com/topkecleon/telegram-bot-bash) and [Do
* Modules, addons, events * Modules, addons, events
* Setup your environment * Setup your environment
* Bashbot test suite * Bashbot test suite
* [Examples Directory](examples/README.md) * [Examples Directory](examples)
* [Webhook Example](examples/webhook)
### Your very first bashbot in a nutshell ### Your very first bashbot in a nutshell
@ -238,4 +239,4 @@ See `mycommnds.sh.dist` for an example.
If you feel that there's something missing or if you found a bug, feel free to submit a pull request! If you feel that there's something missing or if you found a bug, feel free to submit a pull request!
#### $$VERSION$$ v1.32-dev-9-g13052f0 #### $$VERSION$$ v1.40-dev-29-g737be16

View File

@ -112,7 +112,8 @@ Documentation
o Setup your environment o Setup your environment
o Bashbot test suite o Bashbot test suite
* Examples Directory [examples/README.md] * Examples Directory [examples]
* Webhook Example [examples/webhook]
Your very first bashbot in a nutshell Your very first bashbot in a nutshell

View File

@ -30,7 +30,7 @@ BOTCOMMANDS="-h help init start stop status suspendback resumeback killb
# 8 - curl/wget missing # 8 - curl/wget missing
# 10 - not bash! # 10 - not bash!
# #
#### $$VERSION$$ v1.40-dev-27-gc4d100e #### $$VERSION$$ v1.40-dev-29-g737be16
################################################################## ##################################################################
# are we running in a terminal? # are we running in a terminal?
@ -688,7 +688,7 @@ event_send() {
# initialize bot environment, user and permissions # initialize bot environment, user and permissions
bot_init() { bot_init() {
cd "${BASHBOT_HOME}" || printf "Can't change to BASHBOT_HOME" && exit_source 1 cd "${BASHBOT_HOME}" || printf "Can't change to BASHBOT_HOME" && exit_source 1
# load addons on startup # initialize addons
printf "Initialize addons ...\n" printf "Initialize addons ...\n"
for addons in "${ADDONDIR:-.}"/*.sh ; do for addons in "${ADDONDIR:-.}"/*.sh ; do
# shellcheck source=./modules/aliases.sh # shellcheck source=./modules/aliases.sh

View File

@ -1227,8 +1227,8 @@ https://linuxconfig.org/how-to-use-arrays-in-bash-script
### Manage webhook ### Manage webhook
Bashbot default mode is to poll Telegram server for updates but Telegram offers also webhook as a more efficient method to deliver updates. Bashbot default mode is to poll Telegram server for updates but Telegram offers also webhook as a more efficient method to deliver updates.
*Important*: Before using webhook you must setup your server to receive and process updates from Telegram! *Important*: Before enable webhook you must setup your server to [receive and process webhook updates from Telegram](../examples/webhook)
I recommend to use webhook with a test bot first. [Webhook examples](../examples/webhook) I recommend to use webhook with a test bot first.
##### get_webhook_info ##### get_webhook_info
`get_webhook_info` get current status of webhook for your bot, e.g. url, waiting updates, last error. `get_webhook_info` get current status of webhook for your bot, e.g. url, waiting updates, last error.
@ -1578,5 +1578,5 @@ The name of your bot is available as bash variable "$ME", there is no need to ca
#### [Prev Best Practice](5_practice.md) #### [Prev Best Practice](5_practice.md)
#### [Next Notes for Developers](7_develop.md) #### [Next Notes for Developers](7_develop.md)
#### $$VERSION$$ v1.40-dev-17-g8034a5f #### $$VERSION$$ v1.40-dev-29-g737be16

View File

@ -33,15 +33,17 @@ Now your Apache is ready to forward data to Bashbot.
#### Simple update processing #### Simple update processing
To configure simple update processing delete file `data-bot-bash/webhook-fifo` after your webhook is working. To configure `Simple update processing` delete the file `data-bot-bash/webhook-fifo` after your webhook is working.
Every webhook call now forwards incoming Telegram updates to the named pipe `data-bot-bash/webhook-fifo` All webhook calls are now forwarded to `bin/process_update.sh` for processing.
Now enable webhook on Telegram (_see below_). To start `Simple processing ` enable webhook on Telegram (_see below_).
Every incoming Telegram update load Bashbot once for processing one command. Even it seems overkill to load Every incoming Telegram update load Bashbot once for processing one command. Even it seems overkill to load
Bashbot on every update, it's more responsive and create less server load for a low traffic bot. Bashbot on every incoming update, it's more responsive and create less server load for low traffic bots.
*Note:* You must NOT start bashbot when simple update processing is enabled. If your bot uses `addons` or `BASHBOT_EVENTs` you can't use `Simple processing`.
*Note:* `Simple processing` works without running `bashbot.sh start`.
#### High traffic processing #### High traffic processing
@ -51,7 +53,7 @@ Bashbot on every update, it's more responsive and create less server load for a
High traffic processing writes Telegram updates to the named pipe `data-bot-bash/webhook-fifo` High traffic processing writes Telegram updates to the named pipe `data-bot-bash/webhook-fifo`
and Bashbot poll them, this is much more efficient than polling Telegram server. and Bashbot poll them, this is much more efficient than polling Telegram server.
To switch from `Simple processing` to `High traffic processing` start bashbot as `bashbot.sh start-hook`. To switch from `Simple processing` to `High traffic processing` start bashbot as `bashbot.sh start-webhook`.
Stop bashbot with `bashbot.sh stop` to switch back to `Simple processing` Stop bashbot with `bashbot.sh stop` to switch back to `Simple processing`
@ -74,5 +76,5 @@ To stop delivering of Telegram updates via webhook run `bin/any_command.sh delet
**Important**: Only https connections with a valid certificate chain are allowed as endpoint for webhook. **Important**: Only https connections with a valid certificate chain are allowed as endpoint for webhook.
#### $$VERSION$$ v1.40-dev-28-g91a143a #### $$VERSION$$ v1.40-dev-29-g737be16