From d8998ab040f431375e3cfc1be3508281cc4481e4 Mon Sep 17 00:00:00 2001 From: Satyam Bansal Date: Mon, 7 Aug 2023 15:55:50 +0530 Subject: [PATCH] events: Add display name and event types to realm_incoming_webhook_bots. --- api_docs/changelog.md | 5 +++++ version.py | 2 +- zerver/lib/events.py | 8 +++++++- zerver/openapi/zulip.yaml | 20 ++++++++++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/api_docs/changelog.md b/api_docs/changelog.md index 77847eb690..fadc36a114 100644 --- a/api_docs/changelog.md +++ b/api_docs/changelog.md @@ -20,6 +20,11 @@ format used by the Zulip server that they are interacting with. ## Changes in Zulip 8.0 +**Feature level 207** + +* [`POST /register`](/api/register-queue): Added `display_name` and + `all_event_types` fields to the `realm_incoming_webhook_bots` object. + **Feature level 206** * `POST /calls/zoom/create`: Added `is_video_call` parameter diff --git a/version.py b/version.py index 354bd40cda..1cf50ab1a9 100644 --- a/version.py +++ b/version.py @@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.9.3" # Changes should be accompanied by documentation explaining what the # new level means in api_docs/changelog.md, as well as "**Changes**" # entries in the endpoint's documentation in `zulip.yaml`. -API_FEATURE_LEVEL = 206 +API_FEATURE_LEVEL = 207 # Bump the minor PROVISION_VERSION to indicate that folks should provision # only when going from an old version of the code to a newer version. Bump diff --git a/zerver/lib/events.py b/zerver/lib/events.py index 139ef7376f..b8f3483410 100644 --- a/zerver/lib/events.py +++ b/zerver/lib/events.py @@ -19,7 +19,11 @@ from zerver.lib.default_streams import get_default_streams_for_realm_as_dicts from zerver.lib.exceptions import JsonableError from zerver.lib.external_accounts import get_default_external_accounts from zerver.lib.hotspots import get_next_hotspots -from zerver.lib.integrations import EMBEDDED_BOTS, WEBHOOK_INTEGRATIONS +from zerver.lib.integrations import ( + EMBEDDED_BOTS, + WEBHOOK_INTEGRATIONS, + get_all_event_types_for_integration, +) from zerver.lib.message import ( add_message_to_unread_msgs, aggregate_unread_data, @@ -510,6 +514,8 @@ def fetch_initial_state_data( state["realm_incoming_webhook_bots"] = [ { "name": integration.name, + "display_name": integration.display_name, + "all_event_types": get_all_event_types_for_integration(integration), "config": {c[1]: c[0] for c in integration.config_options}, } for integration in WEBHOOK_INTEGRATIONS diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml index 26c0326ec4..96a89d6f02 100644 --- a/zerver/openapi/zulip.yaml +++ b/zerver/openapi/zulip.yaml @@ -11547,6 +11547,26 @@ paths: type: string description: | The name of the bot. + display_name: + type: string + description: | + A human-readable display name identifying the integration that this bot implements, + intended to be used in menus for selecting which integration to create. + + **Changes**: New in Zulip 8.0 (feature level 207). + all_event_types: + type: array + items: + type: string + nullable: true + description: | + For incoming webhook integrations that support the Zulip server filtering incoming + events, the list of event types supported by it. + + A null value will be present if this incoming webhook integration doesn't support + such filtering. + + **Changes**: New in Zulip 8.0 (feature level 207). config: $ref: "#/components/schemas/Config" recent_private_conversations: