2017-06-02 03:58:33 +02:00
|
|
|
Learn how Zulip integrations work with this simple Hello World example!
|
|
|
|
|
|
|
|
The Hello World webhook will use the `test` stream, which is
|
|
|
|
created by default in the Zulip dev environment. If you are running
|
|
|
|
Zulip in production, you should make sure that this stream exists.
|
|
|
|
|
|
|
|
Next, on your {{ settings_html|safe }}, create a Hello World bot.
|
|
|
|
Construct the URL for the Hello World bot using the API key and
|
|
|
|
stream name:
|
|
|
|
|
2017-10-30 22:04:15 +01:00
|
|
|
`{{ api_url }}/v1/external/helloworld?api_key=abcdefgh&stream=test`
|
2017-06-02 03:58:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
To trigger a notification using this webhook, use
|
|
|
|
`send_webhook_fixture_message` from the Zulip command line:
|
|
|
|
|
|
|
|
```
|
2019-01-10 01:30:44 +01:00
|
|
|
(zulip-py3-venv)vagrant@vagrant-ubuntu-trusty-64:/srv/zulip$
|
2017-06-02 03:58:33 +02:00
|
|
|
./manage.py send_webhook_fixture_message \
|
2018-04-19 20:17:24 +02:00
|
|
|
> --fixture=zerver/tests/fixtures/helloworld/hello.json \
|
2017-06-02 03:58:33 +02:00
|
|
|
> '--url=http://localhost:9991/api/v1/external/helloworld?api_key=<api_key>'
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
Or, use curl:
|
|
|
|
|
|
|
|
```
|
|
|
|
curl -X POST -H "Content-Type: application/json" -d '{ "featured_title":"Marilyn Monroe", "featured_url":"https://en.wikipedia.org/wiki/Marilyn_Monroe" }' http://localhost:9991/api/v1/external/helloworld\?api_key\=<api_key>
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
{!congrats.md!}
|
|
|
|
|
|
|
|
![](/static/images/integrations/helloworld/001.png)
|