2017-06-02 03:58:33 +02:00
|
|
|
Learn how Zulip integrations work with this simple Hello World example!
|
|
|
|
|
2021-03-25 09:40:29 +01:00
|
|
|
This webhook is Zulip's official [example
|
|
|
|
integration](/api/incoming-webhooks-walkthrough).
|
|
|
|
|
2021-03-15 19:42:26 +01:00
|
|
|
1. The Hello World webhook will use the `test` stream, which is
|
|
|
|
by default in the Zulip dev environment. If you are running
|
|
|
|
Zulip in production, you should make sure that this stream exists.
|
2017-06-02 03:58:33 +02:00
|
|
|
|
2021-03-15 19:42:26 +01:00
|
|
|
1. Next, on your {{ settings_html|safe }}, create a Hello World bot.
|
|
|
|
the URL for the Hello World bot using the API key and
|
|
|
|
stream name:
|
2017-06-02 03:58:33 +02:00
|
|
|
|
2021-03-15 19:42:26 +01:00
|
|
|
`{{ api_url }}/v1/external/helloworld?api_key=abcdefgh&stream=test`
|
2017-06-02 03:58:33 +02:00
|
|
|
|
2021-03-25 09:40:29 +01:00
|
|
|
1. To trigger a notification using this webhook, you can use
|
|
|
|
`send_webhook_fixture_message` from a [Zulip development
|
|
|
|
environment](https://zulip.readthedocs.io/en/latest/development/overview.html):
|
2017-06-02 03:58:33 +02:00
|
|
|
|
2022-04-19 03:18:48 +02:00
|
|
|
(zulip-py3-venv) vagrant@vagrant:/srv/zulip$
|
2021-03-15 19:42:26 +01:00
|
|
|
./manage.py send_webhook_fixture_message \
|
|
|
|
> --fixture=zerver/tests/fixtures/helloworld/hello.json \
|
|
|
|
> '--url=http://localhost:9991/api/v1/external/helloworld?api_key=<api_key>'
|
2017-06-02 03:58:33 +02:00
|
|
|
|
2021-03-15 19:42:26 +01:00
|
|
|
Or, use curl:
|
2017-06-02 03:58:33 +02:00
|
|
|
|
2021-03-15 19:42:26 +01:00
|
|
|
```
|
|
|
|
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>
|
|
|
|
```
|
2017-06-02 03:58:33 +02:00
|
|
|
|
|
|
|
{!congrats.md!}
|
|
|
|
|
|
|
|
![](/static/images/integrations/helloworld/001.png)
|