api docs: Clean up outgoing webhooks section.

I rewrote the section explaining what the
endpoint sends back to the server.  This fixes
a few typos, emphasizes the normal case, and
starts to favor "content" as the key for
content.
This commit is contained in:
Steve Howell
2018-10-10 10:58:45 +00:00
committed by Tim Abbott
parent 229dd5d861
commit 395d74c08a

View File

@@ -93,17 +93,21 @@ Some of the important fields in the `message` dict include the following:
A correctly implemented endpoint will do the following: A correctly implemented endpoint will do the following:
* For a successful request, it should return receives either a json * It will calculate a response that we call the "content" of
encoded dictionary, describing how to respond to the user. the response.
* If the dictionary contains `response_not_required` set to `True`, no * It will encode the content in Zulip's flavor of markdown (or
response message is sent to the user. just plain text).
* If the dictionary contains `response_string` key, the corresponding * It will then make a dictionary with key of "content" and
value is used as the `content` for a Zulip message sent in response; the value being that content. (Note that "response_string" is
otherwise, a generic default response message is sent. a deprecated synonym for "content".)
* For a failed request, the endpoint should return data on the * It will encode that dictionary as JSON.
error.
### Example payload If the bot code wants to opt out of responding, it can explicitly
encode a JSON dictionary that contains `response_not_required` set
to `True`, so that no response message is sent to the user. (This
is helpful to distinguish deliberate non-responses from bugs.)
### Example incoming payload
{generate_code_example|zulip-outgoing-webhook-payload|fixture} {generate_code_example|zulip-outgoing-webhook-payload|fixture}