outgoing-webhooks.md: Add example payloads/fixtures.

This commit is contained in:
Eeshan Garg 2018-06-02 11:15:18 -02:30 committed by Tim Abbott
parent 67045d65a9
commit 2e78a56796
2 changed files with 59 additions and 3 deletions

View File

@ -331,5 +331,45 @@
"code": "BAD_REQUEST",
"msg": "User not authorized for this query",
"result": "error"
},
"zulip-outgoing-webhook-payload": {
"data": "@**Outgoing Webhook Test** Zulip is the world\u2019s most productive group chat!",
"trigger": "mention",
"token": "xvOzfurIutdRRVLzpXrIIHXJvNfaJLJ0",
"message": {
"subject": "Verona2",
"sender_email": "iago@zulip.com",
"recipient_type": 2,
"timestamp": 1527876931,
"client": "website",
"submessages": [
],
"recipient_id": 20,
"subject_links": [
],
"sender_full_name": "Iago",
"sender_is_mirror_dummy": false,
"rendered_content": "<p><span class=\"user-mention\" data-user-id=\"25\">@Outgoing Webhook Test</span> Zulip is the world\u2019s most productive group chat!</p>",
"sender_avatar_source": "G",
"sender_id": 5,
"stream_id": 5,
"content": "@**Outgoing Webhook Test** Zulip is the world\u2019s most productive group chat!",
"sender_realm_id": 1,
"sender_avatar_version": 1,
"display_recipient": "Verona",
"type": "stream",
"id": 112,
"is_me_message": false,
"reactions": [
],
"sender_realm_str": "zulip",
"raw_display_recipient": "Verona",
"sender_short_name": "iago",
"recipient_type_id": 5
},
"bot_email": "outgoing-bot@localhost"
}
}

View File

@ -69,6 +69,10 @@ A correctly implemented endpoint will do the following:
* For a failed request, the endpoint should return data on the
error.
### Example payload
{generate_code_example|zulip-outgoing-webhook-payload|fixture}
## Slack-format webhook format
This interface translates the Zulip's outgoing webhook's request into
@ -91,11 +95,23 @@ trigger_word: trigger method
service_id: id of bot user
```
The above data is posted as list of tuples (not JSON).
The above data is posted as list of tuples (not JSON), here's an example:
```
[('token', 'abcdef'),
('team_id', 'zulip'),
('team_domain', 'zulip.com'),
('channel_id', '123'),
('channel_name', 'integrations'),
('timestamp', 123456),
('user_id', 21),
('user_name', 'Sample User'),
('text', '@**test**'),
('trigger_word', 'mention'),
('service_id', None)]
```
* For successful request, if data is returned, it returns that data,
else it returns a blank response.
* For failed request, it returns the reason of failure, as returned by
the server, or the exception message.