zulip/api_docs/outgoing-webhook-payload.md

3.2 KiB

Outgoing webhook payloads

Zulip supports outgoing webhooks in a clean, native Zulip format, as well as in a Slack-compatible format.

Zulip format

{generate_code_example|/zulip-outgoing-webhook:post|fixture}

Fields documentation

{generate_return_values_table|zulip.yaml|/zulip-outgoing-webhook:post}

Slack-compatible format

This webhook format is compatible with Slack's outgoing webhook API, which can help with porting an existing Slack integration to work with Zulip, and allows immediate integration with many third-party systems that already support Slack outgoing webhooks.

The following table details how the Zulip server translates a Zulip message into the Slack-compatible webhook format.

Name Description
token A string of alphanumeric characters you can use to authenticate the webhook request (each bot user uses a fixed token)
team_id ID of the Zulip organization prefixed by "T".
team_domain Hostname of the Zulip organization
channel_id Channel ID prefixed by "C"
channel_name Channel name
thread_ts Timestamp for when message was sent
timestamp Timestamp for when message was sent
user_id ID of the user who sent the message prefixed by "U"
user_name Full name of sender
text The content of the message (in Markdown)
trigger_word Trigger method
service_id ID of the bot user

The above data is posted as list of tuples (not JSON), here's an example:

[('token', 'v9fpCdldZIej2bco3uoUvGp06PowKFOf'),
 ('team_id', 'T1512'),
 ('team_domain', 'zulip.example.com'),
 ('channel_id', 'C123'),
 ('channel_name', 'integrations'),
 ('thread_ts', 1532078950),
 ('timestamp', 1532078950),
 ('user_id', 'U21'),
 ('user_name', 'Full Name'),
 ('text', '@**test**'),
 ('trigger_word', 'mention'),
 ('service_id', 27)]
  • For successful requests, if data is returned, it returns that data, else it returns a blank response.
  • For failed requests, it returns the reason of failure, as returned by the server, or the exception message.