snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled

This commit is contained in:
upstream-mirror
2026-09-15 15:05:30 +05:00
commit 64898b2c79
8999 changed files with 1757358 additions and 0 deletions

View File

View File

@@ -0,0 +1,28 @@
# Zulip Freshping integration
Receive Freshping notifications in Zulip!
{start_tabs}
1. {!create-an-incoming-webhook.md!}
1. {!generate-webhook-url-basic.md!}
1. Go to your **Freshping** dashboard, and select **Settings**. Click
**Integrations**, and select **Create Integration** under **Webhooks**.
1. Set **Domain URL** to the URL generated above, and click **Create**.
Once you've created the webhook, you can see if it's configured
correctly by clicking **Test**.
{end_tabs}
{!congrats.md!}
![](/static/images/integrations/freshping/001.png)
{!event-filtering-additional-feature.md!}
### Related documentation
{!webhooks-url-specification.md!}

View File

@@ -0,0 +1,26 @@
{
"organization_name": "Example Org",
"webhook_event_id": 5301955,
"organization_id": 156000,
"webhook_type": "AL",
"webhook_event_data": {
"check_state_name": "Available",
"check_computed_target_response_time": 1000,
"application_id": 155565,
"recently_started_check_state_name": null,
"check_id": 585767,
"recently_started_check_start_time": null,
"http_status_code": 200,
"request_start_time": "2021-04-15T19:57:32.607484+00:00",
"check_name": "Test Check",
"recently_started_check_http_status_code": null,
"application_name": " 's Application",
"recently_started_check_response_time": null,
"request_url": "https://example.com",
"check_target_response_time": 1000,
"@type": "MessageCard",
"response_time": 140
},
"webhook_id": 24172,
"webhook_event_created_on": "2021-04-15T19:57:33.035824+00:00"
}

View File

@@ -0,0 +1,24 @@
{
"organization_name": "Example Org",
"webhook_event_id": 5301811,
"organization_id": 156000,
"webhook_type": "AL",
"webhook_event_data": {
"check_state_name": "Available",
"check_target_response_time": 100,
"recently_started_check_state_name": null,
"check_id": 1,
"recently_started_check_start_time": null,
"http_status_code": 200,
"request_start_time": "2021-04-15T19:36:31.812658+00:00",
"check_name": "Example check",
"recently_started_check_http_status_code": null,
"application_name": "Webhook test",
"recently_started_check_response_time": null,
"request_url": "https://www.example.com/",
"check_computed_target_response_time": 200,
"response_time": 50
},
"webhook_id": 24172,
"webhook_event_created_on": "2021-04-15T19:36:31.812999+00:00"
}

View File

@@ -0,0 +1,26 @@
{
"organization_name": "Example Org",
"webhook_event_id": 5301855,
"organization_id": 156000,
"webhook_type": "AL",
"webhook_event_data": {
"check_state_name": "Reporting Error",
"check_computed_target_response_time": 1000,
"application_id": 155565,
"recently_started_check_state_name": null,
"check_id": 585767,
"recently_started_check_start_time": null,
"http_status_code": 521,
"request_start_time": "2021-04-15T19:46:47.644166+00:00",
"check_name": "Test Check",
"recently_started_check_http_status_code": null,
"application_name": " 's Application",
"recently_started_check_response_time": null,
"request_url": "https://example.com",
"check_target_response_time": 1000,
"@type": "MessageCard",
"response_time": 635
},
"webhook_id": 24172,
"webhook_event_created_on": "2021-04-15T19:46:49.077370+00:00"
}

View File

@@ -0,0 +1,30 @@
from zerver.lib.test_classes import WebhookTestCase
class FreshpingHookTests(WebhookTestCase):
def test_freshping_check_test(self) -> None:
"""
Tests if freshping check test is handled correctly
"""
expected_topic_name = "Freshping"
expected_message = "Freshping webhook has been successfully configured."
self.check_webhook("freshping_check_test", expected_topic_name, expected_message)
def test_freshping_check_unreachable(self) -> None:
"""
Tests if freshping check unreachable is handled correctly
"""
expected_topic_name = "Test Check"
expected_message = """
https://example.com has just become unreachable.
Error code: 521.
""".strip()
self.check_webhook("freshping_check_unreachable", expected_topic_name, expected_message)
def test_freshping_check_reachable(self) -> None:
"""
Tests if freshping check reachable is handled correctly
"""
expected_topic_name = "Test Check"
expected_message = "https://example.com is back up and no longer unreachable."
self.check_webhook("freshping_check_reachable", expected_topic_name, expected_message)

View File

@@ -0,0 +1,73 @@
from django.http import HttpRequest, HttpResponse
from zerver.decorator import webhook_view
from zerver.lib.exceptions import UnsupportedWebhookEventTypeError
from zerver.lib.response import json_success
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, get_setup_webhook_message
from zerver.models import UserProfile
FRESHPING_TOPIC_TEMPLATE_TEST = "Freshping"
FRESHPING_TOPIC_TEMPLATE = "{check_name}"
FRESHPING_MESSAGE_TEMPLATE_UNREACHABLE = """
{request_url} has just become unreachable.
Error code: {http_status_code}.
""".strip()
FRESHPING_MESSAGE_TEMPLATE_UP = "{request_url} is back up and no longer unreachable."
CHECK_STATE_NAME_TO_EVENT_TYPE = {"Reporting Error": "reporting_error", "Available": "available"}
ALL_EVENT_TYPES = list(CHECK_STATE_NAME_TO_EVENT_TYPE.values())
@webhook_view("Freshping", all_event_types=ALL_EVENT_TYPES)
@typed_endpoint
def api_freshping_webhook(
request: HttpRequest,
user_profile: UserProfile,
*,
payload: JsonBodyPayload[WildValue],
) -> HttpResponse:
check_state_name = payload["webhook_event_data"]["check_state_name"].tame(check_string)
if check_state_name not in CHECK_STATE_NAME_TO_EVENT_TYPE:
raise UnsupportedWebhookEventTypeError(check_state_name)
body = get_body_for_http_request(payload)
topic_name = get_topic_for_http_request(payload)
check_send_webhook_message(
request,
user_profile,
topic_name,
body,
CHECK_STATE_NAME_TO_EVENT_TYPE[check_state_name],
)
return json_success(request)
def get_topic_for_http_request(payload: WildValue) -> str:
webhook_event_data = payload["webhook_event_data"]
if webhook_event_data["application_name"].tame(check_string) == "Webhook test":
topic_name = FRESHPING_TOPIC_TEMPLATE_TEST
else:
topic_name = FRESHPING_TOPIC_TEMPLATE.format(
check_name=webhook_event_data["check_name"].tame(check_string)
)
return topic_name
def get_body_for_http_request(payload: WildValue) -> str:
webhook_event_data = payload["webhook_event_data"]
if webhook_event_data["check_state_name"].tame(check_string) == "Reporting Error":
body = FRESHPING_MESSAGE_TEMPLATE_UNREACHABLE.format(
request_url=webhook_event_data["request_url"].tame(check_string),
http_status_code=webhook_event_data["http_status_code"].tame(check_int),
)
elif webhook_event_data["check_state_name"].tame(check_string) == "Available":
if webhook_event_data["application_name"].tame(check_string) == "Webhook test":
body = get_setup_webhook_message("Freshping")
else:
body = FRESHPING_MESSAGE_TEMPLATE_UP.format(
request_url=webhook_event_data["request_url"].tame(check_string)
)
return body