Implement and document new Botserver setup routine.

Previously, the Botserver determined which bot to run for an
outgoing webhook by dispatching on a different URL endpoint
for each bot. Now, instead, the Botserver determines which bot
to run by the section header of the bot in the flaskbotrc.
This commit makes the frontend provide the new flaskbotrc
and updates the setup steps for the Botserver in the docs.
This commit is contained in:
Robert Hönig 2018-05-23 16:20:12 +02:00 committed by Tim Abbott
parent 7a8c1ec9dc
commit bdf79f271d
2 changed files with 22 additions and 7 deletions

View File

@ -71,7 +71,7 @@
<div class="input-group"> <div class="input-group">
<label for="create_payload_url">{{t "Endpoint URL" }}</label> <label for="create_payload_url">{{t "Endpoint URL" }}</label>
<input type="text" name="payload_url" id="create_payload_url" <input type="text" name="payload_url" id="create_payload_url"
maxlength=2083 placeholder="https://hostname.example.com/bots/followup" value="" /> maxlength=2083 placeholder="https://hostname.example.com" value="" />
<div><label for="create_payload_url" generated="true" class="text-error"></label></div> <div><label for="create_payload_url" generated="true" class="text-error"></label></div>
</div> </div>
<div class="input-group"> <div class="input-group">

View File

@ -43,13 +43,12 @@ pip install zulip_botserver
1. Construct the URL for your bot, which will be of the form: 1. Construct the URL for your bot, which will be of the form:
``` ```
http://<hostname>:<port>/bots/<bot_name> http://<hostname>:<port>
``` ```
where the `hostname` is the hostname you'll be running the bot where the `hostname` is the hostname you'll be running the bot
server on, and `port` is the port for it (the recommended default server on, and `port` is the port for it (the recommended default
is `5002`). `bot_name` is the name of the Python module for the is `5002`).
bot you'd like to run.
1. Register new bot users on the Zulip server's web interface. 1. Register new bot users on the Zulip server's web interface.
@ -59,9 +58,25 @@ pip install zulip_botserver
the URL from above) and click on *Create bot*. the URL from above) and click on *Create bot*.
* A new bot user should appear in the *Active bots* panel. * A new bot user should appear in the *Active bots* panel.
1. Download the `flaskbotrc` from the `your-bots` settings page. It 1. Download the `flaskbotrc` from the `your-bots` settings page.
contains the configuration details for all the active outgoing
webhook bots. It's structure is very similar to that of zuliprc. 1. Open the `flaskbotrc`. It should contain one or more sections that look like this:
```
[foo]
email=foo-bot@hostname
key=dOHHlyqgpt5g0tVuVl6NHxDLlc9eFRX4
site=http://hostname
```
Each section contains the configuration for an outgoing webhook bot. For each
bot, enter the name of the bot you want to run in the square brackets `[]`.
For example, if we want `foo-bot@hostname` to run the `helloworld` bot, our
new section would look like this:
```
[helloworld]
email=foo-bot@hostname
key=dOHHlyqgpt5g0tVuVl6NHxDLlc9eFRX4
site=http://hostname
```
1. Run the Zulip Botserver by passing the `flaskbotrc` to it. The 1. Run the Zulip Botserver by passing the `flaskbotrc` to it. The
command format is: command format is: