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: Delete the Insping webhook integration.

Niloth P37c468df13d2
diff --git a/static/images/integrations/bot_avatars/insping.png b/static/images/integrations/bot_avatars/insping.png
deleted file mode 100644
index 9e998c43d94..00000000000
Binary files a/static/images/integrations/bot_avatars/insping.png and /dev/null differ
diff --git a/static/images/integrations/insping/001.png b/static/images/integrations/insping/001.png
deleted file mode 100644
index 56d79eded28..00000000000
Binary files a/static/images/integrations/insping/001.png and /dev/null differ
diff --git a/static/images/integrations/logos/insping.png b/static/images/integrations/logos/insping.png
deleted file mode 100644
index bc05afd13d9..00000000000
Binary files a/static/images/integrations/logos/insping.png and /dev/null differ
diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py
index fe9baf50e93..bc1faf05bd4 100644
--- a/zerver/lib/integrations.py
+++ b/zerver/lib/integrations.py
@@ -734,9 +734,6 @@ INCOMING_WEBHOOK_INTEGRATIONS: list[IncomingWebhookIntegration] = [
display_name="Home Assistant",
),
IncomingWebhookIntegration("ifttt", ["meta-integration"], display_name="IFTTT"),
- IncomingWebhookIntegration(
- "insping", ["monitoring"], [WebhookScreenshotConfig("website_state_available.json")]
- ),
IncomingWebhookIntegration(
"intercom",
["customer-support"],
diff --git a/zerver/webhooks/insping/__init__.py b/zerver/webhooks/insping/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/zerver/webhooks/insping/doc.md b/zerver/webhooks/insping/doc.md
deleted file mode 100644
index f36ca4f4b9a..00000000000
--- a/zerver/webhooks/insping/doc.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# Zulip Insping integration
-
-Get Insping notifications in Zulip! Insping (stylized as !nsping) is a
-simple uptime and performance monitoring tool, which notifies you when
-a website or service is up and running or down.
-
-{start_tabs}
-
-1. {!create-an-incoming-webhook.md!}
-
-1. {!generate-webhook-url-basic.md!}
-
-1. On your Insping **Dashboard**, go to **Integrations**. Click
- on **Create Webhook**.
-
-1. Set **Webhook URL** to the URL generated above. Set **Organization**
- to the organization you would like to receive notifications for, and
- click **Create**. To send a test message to your Zulip organization,
- click on **Test**, and then click **Send Test Data**.
-
-{end_tabs}
-
-{!congrats.md!}
-
-![](/static/images/integrations/insping/001.png)
-
-### Related documentation
-
-{!webhooks-url-specification.md!}
diff --git a/zerver/webhooks/insping/fixtures/website_state_available.json b/zerver/webhooks/insping/fixtures/website_state_available.json
deleted file mode 100644
index 6f5cbc62d57..00000000000
--- a/zerver/webhooks/insping/fixtures/website_state_available.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "organization_name": "test",
- "webhook_event_id": 73418,
- "organization_id": 2587,
- "webhook_type": "AL",
- "webhook_event_data": {
- "check_state_name": "Available",
- "application_id": 2971,
- "check_id": 5630,
- "recently_started_check_start_time": null,
- "http_status_code": 200,
- "request_start_time": "2017-12-29T17:23:46.457990+00:00",
- "recently_started_check_state_name": null,
- "recently_started_check_http_status_code": null,
- "application_name": "test",
- "recently_started_check_response_time": null,
- "request_url": "http://privisus.zulipdev.org:9991",
- "response_time": 223
- },
- "webhook_id": 290,
- "webhook_event_created_on": "2017-12-29T17:23:47.790118+00:00"
-}
diff --git a/zerver/webhooks/insping/fixtures/website_state_not_responding.json b/zerver/webhooks/insping/fixtures/website_state_not_responding.json
deleted file mode 100644
index b6c2b8d25ed..00000000000
--- a/zerver/webhooks/insping/fixtures/website_state_not_responding.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "organization_name": "test",
- "webhook_event_id": 73417,
- "organization_id": 2587,
- "webhook_type": "AL",
- "webhook_event_data": {
- "check_state_name": "Not Responding",
- "application_id": 2971,
- "check_id": 5630,
- "recently_started_check_start_time": null,
- "http_status_code": null,
- "request_start_time": "2017-12-29T17:13:46.788129+00:00",
- "recently_started_check_state_name": null,
- "recently_started_check_http_status_code": null,
- "application_name": "test",
- "recently_started_check_response_time": null,
- "request_url": "http://privisus.zulipdev.org:9991",
- "response_time": 942
- },
- "webhook_id": 290,
- "webhook_event_created_on": "2017-12-29T17:13:48.265870+00:00"
-}
diff --git a/zerver/webhooks/insping/tests.py b/zerver/webhooks/insping/tests.py
deleted file mode 100644
index 438aca23e9d..00000000000
--- a/zerver/webhooks/insping/tests.py
+++ /dev/null
@@ -1,35 +0,0 @@
-from zerver.lib.test_classes import WebhookTestCase
-
-
-class InspingHookTests(WebhookTestCase):
- def test_website_state_available_message(self) -> None:
- expected_topic_name = "insping"
- expected_message = """
-State changed to **Available**:
-* **URL**: http://privisus.zulipdev.org:9991
-* **Response time**: 223 ms
-* **Timestamp**: <time:2017-12-29T17:23:46+00:00>
-""".strip()
-
- self.check_webhook(
- "website_state_available",
- expected_topic_name,
- expected_message,
- content_type="application/x-www-form-urlencoded",
- )
-
- def test_website_state_not_responding_message(self) -> None:
- expected_topic_name = "insping"
- expected_message = """
-State changed to **Not Responding**:
-* **URL**: http://privisus.zulipdev.org:9991
-* **Response time**: 942 ms
-* **Timestamp**: <time:2017-12-29T17:13:46+00:00>
-""".strip()
-
- self.check_webhook(
- "website_state_not_responding",
- expected_topic_name,
- expected_message,
- content_type="application/x-www-form-urlencoded",
- )
diff --git a/zerver/webhooks/insping/view.py b/zerver/webhooks/insping/view.py
deleted file mode 100644
index acf2de302da..00000000000
--- a/zerver/webhooks/insping/view.py
+++ /dev/null
@@ -1,52 +0,0 @@
-from datetime import datetime
-
-from django.http import HttpRequest, HttpResponse
-
-from zerver.decorator import webhook_view
-from zerver.lib.response import json_success
-from zerver.lib.timestamp import datetime_to_global_time
-from zerver.lib.typed_endpoint import JsonBodyPayload, typed_endpoint
-from zerver.lib.validator import WildValue, check_int, check_string
-from zerver.lib.webhooks.common import check_send_webhook_message
-from zerver.models import UserProfile
-
-MESSAGE_TEMPLATE = """
-State changed to **{state}**:
-* **URL**: {url}
-* **Response time**: {response_time} ms
-* **Timestamp**: {timestamp}
-""".strip()
-
-
-def get_global_time(dt_str: str) -> str:
- dt = datetime.fromisoformat(dt_str)
- return datetime_to_global_time(dt)
-
-
-@webhook_view("Insping")
-@typed_endpoint
-def api_insping_webhook(
- request: HttpRequest,
- user_profile: UserProfile,
- *,
- payload: JsonBodyPayload[WildValue],
-) -> HttpResponse:
- data = payload["webhook_event_data"]
-
- state_name = data["check_state_name"].tame(check_string)
- url_tested = data["request_url"].tame(check_string)
- response_time = data["response_time"].tame(check_int)
- timestamp = get_global_time(data["request_start_time"].tame(check_string))
-
- body = MESSAGE_TEMPLATE.format(
- state=state_name,
- url=url_tested,
- response_time=response_time,
- timestamp=timestamp,
- )
-
- topic_name = "insping"
-
- check_send_webhook_message(request, user_profile, topic_name, body)
-
- return json_success(request)