Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

integrations: Rename webhooks to "incoming" webhook integrations.

Niloth Pd3e01266a919
diff --git a/api_docs/incoming-webhooks-overview.md b/api_docs/incoming-webhooks-overview.md
index e3c52be73ac..8044834c557 100644
--- a/api_docs/incoming-webhooks-overview.md
+++ b/api_docs/incoming-webhooks-overview.md
@@ -42,9 +42,8 @@ process.
`zerver/webhooks/<mywebhook>/fixtures/` directory, and add the
captured JSON payload as a test fixture.
-* Create an `Integration` object, and add it to the `WEBHOOK_INTEGRATIONS`
- list in `zerver/lib/integrations.py`. Search for `WebhookIntegration` in that
- file to find an existing one to copy.
+* Create an `IncomingWebhookIntegration` object, and add it to the
+ `INCOMING_WEBHOOK_INTEGRATIONS` list in `zerver/lib/integrations.py`.
* Write a draft webhook handler in `zerver/webhooks/<mywebhook>/view.py`. There
are a lot of examples in the `zerver/webhooks/` directory that you can copy.
@@ -107,7 +106,7 @@ below are for a webhook named `MyWebHook`.
### Files that need to be updated
* `zerver/lib/integrations.py`: Add your integration to
- `WEBHOOK_INTEGRATIONS`. This will automatically register a
+ `INCOMING_WEBHOOK_INTEGRATIONS`. This will automatically register a
URL for the incoming webhook of the form `api/v1/external/mywebhook` and
associate it with the function called `api_mywebhook_webhook` in
`zerver/webhooks/mywebhook/view.py`.
@@ -166,7 +165,7 @@ integration, is:
The list of existing webhook integrations can be found by browsing the
[Integrations documentation](/integrations/) or in
-`zerver/lib/integrations.py` at `WEBHOOK_INTEGRATIONS`.
+`zerver/lib/integrations.py` at `INCOMING_WEBHOOK_INTEGRATIONS`.
Parameters accepted in the URL include:
diff --git a/api_docs/incoming-webhooks-walkthrough.md b/api_docs/incoming-webhooks-walkthrough.md
index ff15dac6551..cf0aeecb4d7 100644
--- a/api_docs/incoming-webhooks-walkthrough.md
+++ b/api_docs/incoming-webhooks-walkthrough.md
@@ -186,13 +186,13 @@ to a URL. This is done in `zerver/lib/integrations.py`.
Look for the lines beginning with:
```python
-WEBHOOK_INTEGRATIONS: List[WebhookIntegration] = [
+INCOMING_WEBHOOK_INTEGRATIONS: List[IncomingWebhookIntegration] = [
```
And you'll find the entry for Hello World:
```python
- WebhookIntegration("helloworld", ["misc"], display_name="Hello World"),
+ IncomingWebhookIntegration("helloworld", ["misc"], display_name="Hello World"),
```
This tells the Zulip API to call the `api_helloworld_webhook` function in
@@ -211,7 +211,7 @@ tools which you can use to test your webhook - 2 command line tools and a GUI.
### Webhooks requiring custom configuration
In cases where an incoming webhook integration supports optional URL parameters,
-one can use the `url_options` feature. It's a field in the `WebhookIntegration`
+one can use the `url_options` feature. It's a field in the `IncomingWebhookIntegration`
class that is used when [generating a URL for an integration](/help/generate-integration-url)
in the web app, which encodes the user input for each URL parameter in the
incoming webhook's URL.
@@ -219,7 +219,7 @@ incoming webhook's URL.
These URL options are declared as follows:
```python
- WebhookIntegration(
+ IncomingWebhookIntegration(
'helloworld',
...
url_options=[
@@ -256,7 +256,7 @@ URL. A typical use case for this would be APIs that require clients
to do a callback to get details beyond an opaque object ID that one
would want to include in a Zulip notification message.
-The `config_options` field in the `WebhookIntegration` class is reserved
+The `config_options` field in the `IncomingWebhookIntegration` class is reserved
for this use case.
### WebhookUrlOption presets
@@ -277,7 +277,7 @@ Using a preset URL option with the `build_preset_config` method:
# zerver/lib/integrations.py
from zerver.lib.webhooks.common import PresetUrlOption, WebhookUrlOption
# -- snip --
- WebhookIntegration(
+ IncomingWebhookIntegration(
"github",
# -- snip --
url_options=[
@@ -511,8 +511,8 @@ There are two parts to the end-user documentation on this page.
The first is the lozenge in the grid of integrations, showing your
integration logo and name, which links to the full documentation.
This is generated automatically once you've registered the integration
-in `WEBHOOK_INTEGRATIONS` in `zerver/lib/integrations.py`, and supports
-some customization via options to the `WebhookIntegration` class.
+in `INCOMING_WEBHOOK_INTEGRATIONS` in `zerver/lib/integrations.py`, and supports
+some customization via options to the `IncomingWebhookIntegration` class.
Second, you need to write the actual documentation content in
`zerver/webhooks/mywebhook/doc.md`.
diff --git a/docs/documentation/integrations.md b/docs/documentation/integrations.md
index 45541eea9d1..094b1e01bde 100644
--- a/docs/documentation/integrations.md
+++ b/docs/documentation/integrations.md
@@ -29,8 +29,8 @@ Typically, the documentation process involves the following steps:
See [Markdown macros](#markdown-macros) for further details.
- Make sure you've added your integration to `zerver/lib/integrations.py` in
- the relevant `*_INTEGRATIONS` list, such as the `WEBHOOK_INTEGRATIONS`
- list for incoming webhook integrations.
+ the relevant `*_INTEGRATIONS` list, such as the
+ `INCOMING_WEBHOOK_INTEGRATIONS` list for incoming webhook integrations.
These lists get aggregated into the `INTEGRATIONS` registry which
configures your integration to appear on the `/integrations` page, and
@@ -55,14 +55,14 @@ Typically, the documentation process involves the following steps:
generate a screenshot of the message to provide an example message in the
integration's documentation.
- If your new integration is not a webhook and does not have fixtures, add a
+ If your new integration is not an incoming webhook and does not have fixtures, add a
message template and topic to `zerver/webhooks/fixtureless_integrations.py`.
Then, add your integration's name to `FIXTURELESS_INTEGRATIONS_WITH_SCREENSHOTS`
in `zerver/lib/integrations.py`. See [this commit][example-commit] for an
example.
Otherwise, you should have already added your integration along with its
- screenshot config to `WEBHOOK_INTEGRATIONS`.
+ screenshot config to `INCOMING_WEBHOOK_INTEGRATIONS`.
Generate the screenshot using `tools/screenshots/generate-integration-docs-screenshot`,
where `integrationname` is the name of the integration:
@@ -115,7 +115,7 @@ Here are a few common macros used to document Zulip's integrations:
- `{!generate-integration-url.md!}` - Instructs user how to get the URL for a
bot for a given integration. An example URL is generated automatically for
- every incoming webhook by using attributes in the `WebhookIntegration` class
+ every incoming webhook by using attributes in the `IncomingWebhookIntegration` class
in [zerver/lib/integrations.py][integrations-file].
**Note:** If special configuration is required to set up the URL and you can't
diff --git a/tools/screenshots/generate-integration-docs-screenshot b/tools/screenshots/generate-integration-docs-screenshot
index b8a7a709d06..7f00610d51c 100755
--- a/tools/screenshots/generate-integration-docs-screenshot
+++ b/tools/screenshots/generate-integration-docs-screenshot
@@ -41,11 +41,11 @@ from zerver.actions.streams import bulk_add_subscriptions
from zerver.actions.user_settings import do_change_avatar_fields
from zerver.lib.integrations import (
FIXTURELESS_INTEGRATIONS_WITH_SCREENSHOTS,
+ INCOMING_WEBHOOK_INTEGRATIONS,
INTEGRATIONS,
- WEBHOOK_INTEGRATIONS,
FixturelessScreenshotConfig,
+ IncomingWebhookIntegration,
Integration,
- WebhookIntegration,
WebhookScreenshotConfig,
get_fixture_path,
get_image_path,
@@ -151,7 +151,7 @@ def custom_headers(headers_json: str) -> dict[str, str]:
def send_bot_payload_message(
bot: UserProfile,
- integration: WebhookIntegration,
+ integration: IncomingWebhookIntegration,
fixture_path: str,
config: WebhookScreenshotConfig,
) -> bool:
@@ -253,7 +253,7 @@ def generate_screenshot_from_config(
create_integration_channel(channel_name, bot)
image_path = get_image_path(integration, screenshot_config)
- if isinstance(integration, WebhookIntegration):
+ if isinstance(integration, IncomingWebhookIntegration):
assert isinstance(screenshot_config, WebhookScreenshotConfig)
fixture_path = get_fixture_path(integration, screenshot_config)
message_sent = send_bot_payload_message(bot, integration, fixture_path, screenshot_config)
@@ -342,7 +342,7 @@ def build_config(options: argparse.Namespace, config_keys: list[str]) -> dict[st
def generate_full_batch_screenshots(
option_key: str,
- integration_list: list[Integration] | list[WebhookIntegration],
+ integration_list: list[Integration] | list[IncomingWebhookIntegration],
batch_type: str,
) -> None:
for key, value in vars(options).items():
@@ -356,7 +356,9 @@ def generate_full_batch_screenshots(
if options.all:
generate_full_batch_screenshots("all", list(INTEGRATIONS.values()), "all integrations")
elif options.all_webhook:
- generate_full_batch_screenshots("all_webhook", WEBHOOK_INTEGRATIONS, "all webhook integrations")
+ generate_full_batch_screenshots(
+ "all_webhook", INCOMING_WEBHOOK_INTEGRATIONS, "all incoming webhook integrations"
+ )
elif options.all_fixtureless:
fixtureless_integrations_list = [
INTEGRATIONS[name] for name in FIXTURELESS_INTEGRATIONS_WITH_SCREENSHOTS
diff --git a/zerver/lib/events.py b/zerver/lib/events.py
index f5b3e8a163b..b8c86c5b279 100644
--- a/zerver/lib/events.py
+++ b/zerver/lib/events.py
@@ -29,7 +29,7 @@ from zerver.lib.exceptions import JsonableError
from zerver.lib.external_accounts import get_default_external_accounts
from zerver.lib.integrations import (
EMBEDDED_BOTS,
- WEBHOOK_INTEGRATIONS,
+ INCOMING_WEBHOOK_INTEGRATIONS,
get_all_event_types_for_integration,
)
from zerver.lib.message import (
@@ -772,7 +772,7 @@ def fetch_initial_state_data(
if integration.url_options
else [],
}
- for integration in WEBHOOK_INTEGRATIONS
+ for integration in INCOMING_WEBHOOK_INTEGRATIONS
if integration.legacy is False
]
diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py
index f1d7b1a3fec..6defa36d7c9 100644
--- a/zerver/lib/integrations.py
+++ b/zerver/lib/integrations.py
@@ -21,14 +21,14 @@ from zerver.webhooks import fixtureless_integrations
in the Zulip server.
The Integration class is used as part of generating the
-documentation on the /integrations/ page, while the WebhookIntegration class
-is also used to generate the URLs in `zproject/urls.py` for webhook
-integrations.
+documentation on the /integrations/ page, while the
+IncomingWebhookIntegration class is also used to generate the URLs in
+`zproject/urls.py` for incoming webhook integrations.
To add a new integration, register it in the appropriate *_INTEGRATIONS
list. For example, to add a new incoming webhook integration, declare a
-WebhookIntegration in the WEBHOOK_INTEGRATIONS list. All *_INTEGRATIONS
-lists are automatically aggregated into the INTEGRATIONS dict.
+IncomingWebhookIntegration in the INCOMING_WEBHOOK_INTEGRATIONS list. All
+*_INTEGRATIONS lists are automatically aggregated into the INTEGRATIONS dict.
To add a new integration category, add to either the CATEGORIES or
META_CATEGORY dicts below. The META_CATEGORY dict is for categories
@@ -64,7 +64,7 @@ CATEGORIES: dict[str, StrPromise] = {
}
# Can also be computed from INTEGRATIONS by removing entries from
-# WEBHOOK_INTEGRATIONS and NO_SCREENSHOT_CONFIG, but defined explicitly to
+# INCOMING_WEBHOOK_INTEGRATIONS and NO_SCREENSHOT_CONFIG, but defined explicitly to
# avoid circular dependency
FIXTURELESS_INTEGRATIONS_WITH_SCREENSHOTS: list[str] = [
"asana",
@@ -319,7 +319,7 @@ class PythonAPIIntegration(Integration):
)
-class WebhookIntegration(Integration):
+class IncomingWebhookIntegration(Integration):
DEFAULT_FUNCTION_PATH = "zerver.webhooks.{dir_name}.view.api_{dir_name}_webhook"
DEFAULT_URL = "api/v1/external/{name}"
DEFAULT_CLIENT_NAME = "Zulip{name}Webhook"
@@ -396,7 +396,7 @@ def split_fixture_path(path: str) -> tuple[str, str]:
def get_fixture_path(
- integration: WebhookIntegration, screenshot_config: WebhookScreenshotConfig
+ integration: IncomingWebhookIntegration, screenshot_config: WebhookScreenshotConfig
) -> str:
fixture_dir = os.path.join("zerver", "webhooks", integration.dir_name, "fixtures")
fixture_path = os.path.join(fixture_dir, screenshot_config.fixture_name)
@@ -470,12 +470,14 @@ EMBEDDED_BOTS: list[EmbeddedBotIntegration] = [
EmbeddedBotIntegration("followup", []),
]
-WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
- WebhookIntegration("airbrake", ["monitoring"], [WebhookScreenshotConfig("error_message.json")]),
- WebhookIntegration(
+INCOMING_WEBHOOK_INTEGRATIONS: list[IncomingWebhookIntegration] = [
+ IncomingWebhookIntegration(
+ "airbrake", ["monitoring"], [WebhookScreenshotConfig("error_message.json")]
+ ),
+ IncomingWebhookIntegration(
"airbyte", ["deployment"], [WebhookScreenshotConfig("airbyte_job_payload_success.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"alertmanager",
["monitoring"],
[
@@ -486,35 +488,35 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
display_name="Prometheus Alertmanager",
logo="images/integrations/logos/prometheus.svg",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"ansibletower",
["deployment"],
[WebhookScreenshotConfig("job_successful_multiple_hosts.json")],
display_name="Ansible Tower",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"appfollow",
["marketing", "customer-support"],
[WebhookScreenshotConfig("review.json")],
display_name="AppFollow",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"appveyor",
["continuous-integration"],
[WebhookScreenshotConfig("appveyor_build_success.json")],
display_name="AppVeyor",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"azuredevops",
["continuous-integration"],
[WebhookScreenshotConfig("code_push.json")],
display_name="AzureDevOps",
url_options=[WebhookUrlOption.build_preset_config(PresetUrlOption.BRANCHES)],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"basecamp", ["project-management"], [WebhookScreenshotConfig("doc_active.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"beanstalk",
["version-control"],
[
@@ -526,7 +528,7 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
)
],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"beeminder",
["productivity"],
# The fixture's goal.losedate needs to be modified dynamically
@@ -534,7 +536,7 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
# [WebhookScreenshotConfig("derail_worried.json")],
display_name="Beeminder",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"bitbucket",
["version-control"],
[
@@ -550,7 +552,7 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
secondary_line_text="(Enterprise)",
legacy=True,
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"bitbucket2",
["version-control"],
[
@@ -566,7 +568,7 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
display_name="Bitbucket",
url_options=[WebhookUrlOption.build_preset_config(PresetUrlOption.BRANCHES)],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"bitbucket3",
["version-control"],
[
@@ -582,70 +584,76 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
display_name="Bitbucket Server",
url_options=[WebhookUrlOption.build_preset_config(PresetUrlOption.BRANCHES)],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"buildbot", ["continuous-integration"], [WebhookScreenshotConfig("started.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"canarytoken",
["monitoring"],
[WebhookScreenshotConfig("canarytoken_real.json")],
display_name="Thinkst Canarytokens",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"circleci",
["continuous-integration"],
[WebhookScreenshotConfig("github_job_completed.json")],
display_name="CircleCI",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"clubhouse", ["project-management"], [WebhookScreenshotConfig("story_create.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"codeship",
["continuous-integration", "deployment"],
[WebhookScreenshotConfig("error_build.json")],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"crashlytics", ["monitoring"], [WebhookScreenshotConfig("issue_message.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"delighted",
["customer-support", "marketing"],
[WebhookScreenshotConfig("survey_response_updated_promoter.json")],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"dialogflow",
["customer-support"],
[WebhookScreenshotConfig("weather_app.json", extra_params={"email": "[email protected]"})],
),
- WebhookIntegration("dropbox", ["productivity"], [WebhookScreenshotConfig("file_updated.json")]),
- WebhookIntegration("errbit", ["monitoring"], [WebhookScreenshotConfig("error_message.json")]),
- WebhookIntegration("flock", ["communication"], [WebhookScreenshotConfig("messages.json")]),
- WebhookIntegration(
+ IncomingWebhookIntegration(
+ "dropbox", ["productivity"], [WebhookScreenshotConfig("file_updated.json")]
+ ),
+ IncomingWebhookIntegration(
+ "errbit", ["monitoring"], [WebhookScreenshotConfig("error_message.json")]
+ ),
+ IncomingWebhookIntegration(
+ "flock", ["communication"], [WebhookScreenshotConfig("messages.json")]
+ ),
+ IncomingWebhookIntegration(
"freshdesk",
["customer-support"],
[WebhookScreenshotConfig("ticket_created.json", image_name="004.png", use_basic_auth=True)],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"freshping", ["monitoring"], [WebhookScreenshotConfig("freshping_check_unreachable.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"freshstatus",
["monitoring", "customer-support"],
[WebhookScreenshotConfig("freshstatus_incident_open.json")],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"front",
["customer-support", "communication"],
[WebhookScreenshotConfig("inbound_message.json")],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"gitea",
["version-control"],
[WebhookScreenshotConfig("pull_request__merged.json", channel="commits")],
url_options=[WebhookUrlOption.build_preset_config(PresetUrlOption.BRANCHES)],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"github",
["version-control", "continuous-integration", "project-management"],
[WebhookScreenshotConfig("push__1_commit.json", channel="commits")],
@@ -660,7 +668,7 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
),
],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"githubsponsors",
["financial"],
[WebhookScreenshotConfig("created.json", channel="github")],
@@ -669,7 +677,7 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
dir_name="github",
doc="github/githubsponsors.md",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"gitlab",
["version-control"],
[
@@ -680,39 +688,39 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
display_name="GitLab",
url_options=[WebhookUrlOption.build_preset_config(PresetUrlOption.BRANCHES)],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"gocd",
["continuous-integration"],
[WebhookScreenshotConfig("pipeline_with_mixed_job_result.json")],
display_name="GoCD",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"gogs",
["version-control"],
[WebhookScreenshotConfig("pull_request__opened.json", channel="commits")],
url_options=[WebhookUrlOption.build_preset_config(PresetUrlOption.BRANCHES)],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"gosquared",
["marketing"],
[WebhookScreenshotConfig("traffic_spike.json")],
display_name="GoSquared",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"grafana", ["monitoring"], [WebhookScreenshotConfig("alert_values_v11.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"greenhouse", ["hr"], [WebhookScreenshotConfig("candidate_stage_change.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"groove", ["customer-support"], [WebhookScreenshotConfig("ticket_started.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"harbor",
["deployment"],
[WebhookScreenshotConfig("scanning_completed.json")],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"hellosign",
["productivity", "hr"],
[
@@ -724,83 +732,85 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
],
display_name="HelloSign",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"helloworld", ["misc"], [WebhookScreenshotConfig("hello.json")], display_name="Hello World"
),
- WebhookIntegration("heroku", ["deployment"], [WebhookScreenshotConfig("deploy.txt")]),
- WebhookIntegration(
+ IncomingWebhookIntegration("heroku", ["deployment"], [WebhookScreenshotConfig("deploy.txt")]),
+ IncomingWebhookIntegration(
"homeassistant",
["misc"],
[WebhookScreenshotConfig("reqwithtitle.json")],
display_name="Home Assistant",
),
- WebhookIntegration("ifttt", ["meta-integration"], display_name="IFTTT"),
- WebhookIntegration(
+ IncomingWebhookIntegration("ifttt", ["meta-integration"], display_name="IFTTT"),
+ IncomingWebhookIntegration(
"insping", ["monitoring"], [WebhookScreenshotConfig("website_state_available.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"intercom",
["customer-support"],
[WebhookScreenshotConfig("conversation_admin_replied.json")],
),
# Avoid collision with jira-plugin's doc "jira/doc.md".
- WebhookIntegration(
+ IncomingWebhookIntegration(
"jira",
["project-management"],
[WebhookScreenshotConfig("created_v1.json")],
doc="jira/jira-doc.md",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"jotform", ["productivity"], [WebhookScreenshotConfig("screenshot_response.multipart")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"json",
["misc"],
[WebhookScreenshotConfig("json_github_push__1_commit.json")],
display_name="JSON formatter",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"librato",
["monitoring"],
[WebhookScreenshotConfig("three_conditions_alert.json", payload_as_query_param=True)],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"lidarr", ["entertainment"], [WebhookScreenshotConfig("lidarr_album_grabbed.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"linear", ["project-management"], [WebhookScreenshotConfig("issue_create_complex.json")]
),
- WebhookIntegration("mention", ["marketing"], [WebhookScreenshotConfig("webfeeds.json")]),
- WebhookIntegration(
+ IncomingWebhookIntegration(
+ "mention", ["marketing"], [WebhookScreenshotConfig("webfeeds.json")]
+ ),
+ IncomingWebhookIntegration(
"netlify",
["deployment", "continuous-integration"],
[WebhookScreenshotConfig("deploy_building.json")],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"newrelic",
["monitoring"],
[WebhookScreenshotConfig("incident_activated_new_default_payload.json")],
display_name="New Relic",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"opencollective",
["financial"],
[WebhookScreenshotConfig("one_time_donation.json")],
display_name="Open Collective",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"openproject",
["project-management"],
[WebhookScreenshotConfig("project_created__without_parent.json")],
display_name="OpenProject",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"opensearch",
["monitoring"],
[WebhookScreenshotConfig("example_template.txt")],
display_name="OpenSearch",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"opsgenie",
["monitoring"],
[WebhookScreenshotConfig("addrecipient.json")],
@@ -812,92 +822,94 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
)
],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"pagerduty",
["monitoring"],
[WebhookScreenshotConfig("trigger_v2.json")],
display_name="PagerDuty",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"papertrail",
["monitoring"],
[WebhookScreenshotConfig("short_post.json", payload_as_query_param=True)],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"patreon", ["financial"], [WebhookScreenshotConfig("members_pledge_create.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"pingdom", ["monitoring"], [WebhookScreenshotConfig("http_up_to_down.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"pivotal",
["project-management"],
[WebhookScreenshotConfig("v5_type_changed.json")],
display_name="Pivotal Tracker",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"radarr", ["entertainment"], [WebhookScreenshotConfig("radarr_movie_grabbed.json")]
),
- WebhookIntegration("raygun", ["monitoring"], [WebhookScreenshotConfig("new_error.json")]),
- WebhookIntegration(
+ IncomingWebhookIntegration(
+ "raygun", ["monitoring"], [WebhookScreenshotConfig("new_error.json")]
+ ),
+ IncomingWebhookIntegration(
"reviewboard",
["productivity"],
[WebhookScreenshotConfig("review_request_published.json")],
display_name="Review Board",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"rhodecode",
["version-control"],
[WebhookScreenshotConfig("push.json", channel="commits")],
display_name="RhodeCode",
url_options=[WebhookUrlOption.build_preset_config(PresetUrlOption.BRANCHES)],
),
- WebhookIntegration("rundeck", ["deployment"], [WebhookScreenshotConfig("start.json")]),
- WebhookIntegration(
+ IncomingWebhookIntegration("rundeck", ["deployment"], [WebhookScreenshotConfig("start.json")]),
+ IncomingWebhookIntegration(
"semaphore",
["continuous-integration", "deployment"],
[WebhookScreenshotConfig("pull_request.json")],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"sentry", ["monitoring"], [WebhookScreenshotConfig("event_for_exception_python.json")]
),
- WebhookIntegration("slack", ["communication"]),
- WebhookIntegration(
+ IncomingWebhookIntegration("slack", ["communication"]),
+ IncomingWebhookIntegration(
"slack_incoming",
["communication", "meta-integration"],
display_name="Slack-compatible webhook",
logo="images/integrations/logos/slack.svg",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"sonarqube",
["continuous-integration", "monitoring"],
[WebhookScreenshotConfig("error.json")],
display_name="SonarQube",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"sonarr", ["entertainment"], [WebhookScreenshotConfig("sonarr_episode_grabbed.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"splunk", ["monitoring"], [WebhookScreenshotConfig("search_one_result.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"statuspage",
["customer-support", "monitoring"],
[WebhookScreenshotConfig("incident_created.json")],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"stripe", ["financial"], [WebhookScreenshotConfig("charge_succeeded__card.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"taiga", ["project-management"], [WebhookScreenshotConfig("userstory_changed_status.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"teamcity", ["continuous-integration"], [WebhookScreenshotConfig("success.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"thinkst", ["monitoring"], [WebhookScreenshotConfig("canary_consolidated_port_scan.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"transifex",
["misc"],
[
@@ -913,38 +925,40 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
)
],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"travis",
["continuous-integration"],
[WebhookScreenshotConfig("build.json", payload_as_query_param=True)],
display_name="Travis CI",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"trello", ["project-management"], [WebhookScreenshotConfig("adding_comment_to_card.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"updown", ["monitoring"], [WebhookScreenshotConfig("check_multiple_events.json")]
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"uptimerobot",
["monitoring"],
[WebhookScreenshotConfig("uptimerobot_monitor_up.json")],
display_name="UptimeRobot",
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"wekan",
["productivity", "project-management"],
[WebhookScreenshotConfig("add_comment.json")],
),
- WebhookIntegration(
+ IncomingWebhookIntegration(
"wordpress",
["marketing"],
[WebhookScreenshotConfig("publish_post.txt", "wordpress_post_created.png")],
display_name="WordPress",
),
- WebhookIntegration("zabbix", ["monitoring"], [WebhookScreenshotConfig("zabbix_alert.json")]),
- WebhookIntegration("zapier", ["meta-integration"]),
- WebhookIntegration(
+ IncomingWebhookIntegration(
+ "zabbix", ["monitoring"], [WebhookScreenshotConfig("zabbix_alert.json")]
+ ),
+ IncomingWebhookIntegration("zapier", ["meta-integration"]),
+ IncomingWebhookIntegration(
"zendesk",
["customer-support"],
[
@@ -1095,7 +1109,7 @@ HUBOT_INTEGRATIONS: list[HubotIntegration] = [
INTEGRATIONS: dict[str, Integration] = {
integration.name: integration
for integration in chain(
- WEBHOOK_INTEGRATIONS,
+ INCOMING_WEBHOOK_INTEGRATIONS,
PYTHON_API_INTEGRATIONS,
BOT_INTEGRATIONS,
HUBOT_INTEGRATIONS,
@@ -1146,7 +1160,7 @@ NO_SCREENSHOT_CONFIG = INTEGRATIONS_MISSING_SCREENSHOT_CONFIG | INTEGRATIONS_WIT
def get_all_event_types_for_integration(integration: Integration) -> list[str] | None:
integration = INTEGRATIONS[integration.name]
- if isinstance(integration, WebhookIntegration):
+ if isinstance(integration, IncomingWebhookIntegration):
if integration.name == "githubsponsors":
return import_string("zerver.webhooks.github.view.SPONSORS_EVENT_TYPES")
function = integration.get_function()
diff --git a/zerver/lib/test_helpers.py b/zerver/lib/test_helpers.py
index 495698163d5..b541817d536 100644
--- a/zerver/lib/test_helpers.py
+++ b/zerver/lib/test_helpers.py
@@ -35,7 +35,7 @@ from zerver.lib import cache
from zerver.lib.avatar import avatar_url
from zerver.lib.cache import get_cache_backend
from zerver.lib.db import Params, Query, TimeTrackingCursor
-from zerver.lib.integrations import WEBHOOK_INTEGRATIONS
+from zerver.lib.integrations import INCOMING_WEBHOOK_INTEGRATIONS
from zerver.lib.per_request_cache import flush_per_request_caches
from zerver.lib.rate_limiter import RateLimitedIPAddr, rules
from zerver.lib.request import RequestNotes
@@ -571,7 +571,7 @@ def write_instrumentation_reports(full_suite: bool, include_webhooks: bool) -> N
# This endpoint only returns 500 and 404 codes, so it doesn't get picked up
# by find_pattern above and therefore needs to be exempt.
"self-hosted-billing/not-configured/",
- *(webhook.url for webhook in WEBHOOK_INTEGRATIONS if not include_webhooks),
+ *(webhook.url for webhook in INCOMING_WEBHOOK_INTEGRATIONS if not include_webhooks),
}
untested_patterns -= exempt_patterns
diff --git a/zerver/lib/users.py b/zerver/lib/users.py
index a8886e10627..beacd116613 100644
--- a/zerver/lib/users.py
+++ b/zerver/lib/users.py
@@ -124,10 +124,10 @@ def check_valid_bot_config(
bot_type: int, service_name: str, config_data: Mapping[str, str]
) -> None:
if bot_type == UserProfile.INCOMING_WEBHOOK_BOT:
- from zerver.lib.integrations import WEBHOOK_INTEGRATIONS
+ from zerver.lib.integrations import INCOMING_WEBHOOK_INTEGRATIONS
config_options = None
- for integration in WEBHOOK_INTEGRATIONS:
+ for integration in INCOMING_WEBHOOK_INTEGRATIONS:
if integration.name == service_name:
# key: validator
config_options = {
diff --git a/zerver/tests/test_bots.py b/zerver/tests/test_bots.py
index 940e6ad54a3..38fedf22096 100644
--- a/zerver/tests/test_bots.py
+++ b/zerver/tests/test_bots.py
@@ -18,7 +18,7 @@ from zerver.actions.user_groups import check_add_user_group
from zerver.actions.users import do_change_can_create_users, do_change_user_role, do_deactivate_user
from zerver.lib.bot_config import ConfigError, get_bot_config
from zerver.lib.bot_lib import get_bot_handler
-from zerver.lib.integrations import EMBEDDED_BOTS, WebhookIntegration
+from zerver.lib.integrations import EMBEDDED_BOTS, IncomingWebhookIntegration
from zerver.lib.request import RequestNotes
from zerver.lib.test_classes import UploadSerializeMixin, ZulipTestCase
from zerver.lib.test_helpers import avatar_disk_path, get_test_image_file
@@ -40,7 +40,7 @@ def _check_string(var_name: str, val: str) -> str | None:
test_sample_config_options = [
- WebhookIntegration(
+ IncomingWebhookIntegration(
"stripe",
["financial"],
display_name="Stripe",
@@ -50,7 +50,7 @@ test_sample_config_options = [
)
],
),
- WebhookIntegration("helloworld", ["misc"], display_name="Hello World"),
+ IncomingWebhookIntegration("helloworld", ["misc"], display_name="Hello World"),
]
@@ -2044,7 +2044,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
self.assertEqual(bot_owner_user_ids(new_bot), set())
- @patch("zerver.lib.integrations.WEBHOOK_INTEGRATIONS", test_sample_config_options)
+ @patch("zerver.lib.integrations.INCOMING_WEBHOOK_INTEGRATIONS", test_sample_config_options)
def test_create_incoming_webhook_bot_with_service_name_and_with_keys(self) -> None:
self.login("hamlet")
bot_metadata = {
@@ -2061,7 +2061,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
config_data, {"integration_id": "stripe", "stripe_api_key": "sample-api-key"}
)
- @patch("zerver.lib.integrations.WEBHOOK_INTEGRATIONS", test_sample_config_options)
+ @patch("zerver.lib.integrations.INCOMING_WEBHOOK_INTEGRATIONS", test_sample_config_options)
def test_create_incoming_webhook_bot_with_service_name_and_no_config_options(self) -> None:
self.login("hamlet")
bot_metadata = {
@@ -2075,7 +2075,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
config_data = get_bot_config(new_bot)
self.assertEqual(config_data, {"integration_id": "helloworld"})
- @patch("zerver.lib.integrations.WEBHOOK_INTEGRATIONS", test_sample_config_options)
+ @patch("zerver.lib.integrations.INCOMING_WEBHOOK_INTEGRATIONS", test_sample_config_options)
def test_create_incoming_webhook_bot_with_service_name_incorrect_keys(self) -> None:
self.login("hamlet")
bot_metadata = {
@@ -2092,7 +2092,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
with self.assertRaises(UserProfile.DoesNotExist):
UserProfile.objects.get(full_name="My Stripe Bot")
- @patch("zerver.lib.integrations.WEBHOOK_INTEGRATIONS", test_sample_config_options)
+ @patch("zerver.lib.integrations.INCOMING_WEBHOOK_INTEGRATIONS", test_sample_config_options)
def test_create_incoming_webhook_bot_with_service_name_without_keys(self) -> None:
self.login("hamlet")
bot_metadata = {
@@ -2108,7 +2108,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
with self.assertRaises(UserProfile.DoesNotExist):
UserProfile.objects.get(full_name="My Stripe Bot")
- @patch("zerver.lib.integrations.WEBHOOK_INTEGRATIONS", test_sample_config_options)
+ @patch("zerver.lib.integrations.INCOMING_WEBHOOK_INTEGRATIONS", test_sample_config_options)
def test_create_incoming_webhook_bot_without_service_name(self) -> None:
self.login("hamlet")
bot_metadata = {
@@ -2121,7 +2121,7 @@ class BotTest(ZulipTestCase, UploadSerializeMixin):
with self.assertRaises(ConfigError):
get_bot_config(new_bot)
- @patch("zerver.lib.integrations.WEBHOOK_INTEGRATIONS", test_sample_config_options)
+ @patch("zerver.lib.integrations.INCOMING_WEBHOOK_INTEGRATIONS", test_sample_config_options)
def test_create_incoming_webhook_bot_with_incorrect_service_name(self) -> None:
self.login("hamlet")
bot_metadata = {
diff --git a/zerver/tests/test_integrations.py b/zerver/tests/test_integrations.py
index eb1dcbefef6..8969f4e2a33 100644
--- a/zerver/tests/test_integrations.py
+++ b/zerver/tests/test_integrations.py
@@ -5,19 +5,19 @@ from zerver.lib.integrations import (
EMBEDDED_BOTS,
EMBEDDED_INTEGRATIONS,
HUBOT_INTEGRATIONS,
+ INCOMING_WEBHOOK_INTEGRATIONS,
INTEGRATIONS,
NO_SCREENSHOT_CONFIG,
PLUGIN_INTEGRATIONS,
PYTHON_API_INTEGRATIONS,
STANDALONE_REPO_INTEGRATIONS,
VIDEO_CALL_INTEGRATIONS,
- WEBHOOK_INTEGRATIONS,
ZAPIER_INTEGRATIONS,
BotIntegration,
HubotIntegration,
+ IncomingWebhookIntegration,
Integration,
PythonAPIIntegration,
- WebhookIntegration,
WebhookScreenshotConfig,
get_fixture_path,
get_image_path,
@@ -35,7 +35,7 @@ class IntegrationsTestCase(ZulipTestCase):
def test_get_fixture_and_image_paths(self) -> None:
integration = INTEGRATIONS["airbrake"]
- assert isinstance(integration, WebhookIntegration)
+ assert isinstance(integration, IncomingWebhookIntegration)
screenshot_config = WebhookScreenshotConfig("error_message.json", "002.png", "ci")
fixture_path = get_fixture_path(integration, screenshot_config)
image_path = get_image_path(integration, screenshot_config)
@@ -125,7 +125,7 @@ class IntegrationsTestCase(ZulipTestCase):
if integration.screenshot_configs is None:
continue
for screenshot_config in integration.screenshot_configs:
- if isinstance(integration, WebhookIntegration):
+ if isinstance(integration, IncomingWebhookIntegration):
assert isinstance(screenshot_config, WebhookScreenshotConfig)
if screenshot_config.fixture_name == "":
# Skip screenshot configs of webhooks with a placeholder fixture_name
@@ -150,12 +150,12 @@ class IntegrationsTestCase(ZulipTestCase):
integration_lists: dict[
str,
list[Integration]
- | list[WebhookIntegration]
+ | list[IncomingWebhookIntegration]
| list[BotIntegration]
| list[HubotIntegration]
| list[PythonAPIIntegration],
] = {
- "WEBHOOK_INTEGRATIONS": WEBHOOK_INTEGRATIONS,
+ "INCOMING_WEBHOOK_INTEGRATIONS": INCOMING_WEBHOOK_INTEGRATIONS,
"PYTHON_API_INTEGRATIONS": PYTHON_API_INTEGRATIONS,
"BOT_INTEGRATIONS": BOT_INTEGRATIONS,
"HUBOT_INTEGRATIONS": HUBOT_INTEGRATIONS,
diff --git a/zerver/views/development/integrations.py b/zerver/views/development/integrations.py
index f5007bcbe2f..7ecdd72b57d 100644
--- a/zerver/views/development/integrations.py
+++ b/zerver/views/development/integrations.py
@@ -10,7 +10,7 @@ from django.test import Client
from pydantic import Json
from zerver.lib.exceptions import JsonableError, ResourceNotFoundError
-from zerver.lib.integrations import WEBHOOK_INTEGRATIONS
+from zerver.lib.integrations import INCOMING_WEBHOOK_INTEGRATIONS
from zerver.lib.response import json_success
from zerver.lib.typed_endpoint import PathOnly, typed_endpoint
from zerver.lib.webhooks.common import get_fixture_http_headers, standardize_headers
@@ -24,7 +24,7 @@ ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../../
def get_webhook_integrations() -> list[str]:
- return [integration.name for integration in WEBHOOK_INTEGRATIONS]
+ return [integration.name for integration in INCOMING_WEBHOOK_INTEGRATIONS]
def get_valid_integration_name(name: str) -> str | None:
diff --git a/zerver/views/documentation.py b/zerver/views/documentation.py
index c77320328e2..c9bcfd9b560 100644
--- a/zerver/views/documentation.py
+++ b/zerver/views/documentation.py
@@ -25,9 +25,9 @@ from zerver.lib.integrations import (
INTEGRATIONS,
META_CATEGORY,
HubotIntegration,
+ IncomingWebhookIntegration,
Integration,
PythonAPIIntegration,
- WebhookIntegration,
get_all_event_types_for_integration,
)
from zerver.lib.subdomains import get_subdomain
@@ -364,7 +364,7 @@ def build_integration_doc_html(integration: Integration, request: HttpRequest) -
context["integration_name"] = integration.name
context["integration_display_name"] = integration.display_name
- if isinstance(integration, WebhookIntegration):
+ if isinstance(integration, IncomingWebhookIntegration):
assert integration.url.startswith("api/")
context["integration_url"] = integration.url.removeprefix("api")
all_event_types = get_all_event_types_for_integration(integration)
diff --git a/zproject/urls.py b/zproject/urls.py
index 8ac2fecc4f0..b568d4ad215 100644
--- a/zproject/urls.py
+++ b/zproject/urls.py
@@ -15,7 +15,7 @@ from django.utils.module_loading import import_string
from django.views.generic import RedirectView
from zerver.forms import LoggingSetPasswordForm
-from zerver.lib.integrations import WEBHOOK_INTEGRATIONS
+from zerver.lib.integrations import INCOMING_WEBHOOK_INTEGRATIONS
from zerver.lib.rest import rest_path
from zerver.lib.url_redirects import DOCUMENTATION_REDIRECTS, get_integration_category_redirects
from zerver.tornado.views import (
@@ -837,7 +837,7 @@ urls += [
# Incoming webhook URLs
# We don't create URLs for particular Git integrations here
# because of generic one below
-urls.extend(incoming_webhook.url_object for incoming_webhook in WEBHOOK_INTEGRATIONS)
+urls.extend(incoming_webhook.url_object for incoming_webhook in INCOMING_WEBHOOK_INTEGRATIONS)
# Desktop-specific authentication URLs
urls += [