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,35 @@
# Zulip GoSquared integration
Receive GoSquared notifications in Zulip!
{start_tabs}
1. {!create-an-incoming-webhook.md!}
1. {!generate-webhook-url-basic.md!}
1. Go to your project's **Settings**, and click on **Services**.
Scroll down and next to **Webhook**, click on **Connect**. Click
**Add new**.
1. Set **Webhook URL** to the URL generated above. Set **Name** to a
name of your choice, such as `Zulip`. Click **Save Integration**.
1. In your project's **Settings**, click on **Notifications**. Click
**Add new notification**.
1. Under **Trigger**, you can configure when notifications are
triggered. Under **Delivery**, toggle the **Webhook** checkbox,
and click **Add**.
{end_tabs}
{!congrats.md!}
![](/static/images/integrations/gosquared/001.png)
{!event-filtering-additional-feature.md!}
### Related documentation
{!webhooks-url-specification.md!}

View File

@@ -0,0 +1,83 @@
{
"site_token":"GSN-47568-O",
"timestamp":"2018-11-07T21:48:16.072Z",
"version":"0.0.1",
"person":{
"status":"visitor",
"_anon":{
"name":"John Smith",
"shape":"sun-shape",
"color":"#1F3A93"
},
"presence":"online",
"chat":{
"language":"de-DE",
"agent":{
"assigned":null,
"delivered":1541627243633,
"read":1541623962177
},
"client":{
"delivered":0,
"read":1541627243633
},
"archived":null,
"translationPaused":false,
"latest":{
"timestamp":1541627296072,
"message":{
"session":{
"title":"Zulip Chat",
"href":"https:\/\/www.zulipchat.com\/"
},
"data":{
},
"content":"Zulip is awesome!",
"id":"984fde4-86fd-2345-sldk-2sdkfksldff",
"from":"client",
"type":"message",
"timestamp":1541627296072,
"private":false,
"entities":[
]
}
}
},
"lead":{
"email":""
},
"_links":[
{
"method":"GET",
"rel":"self",
"href":"https:\/\/api.gosquared.com\/chat\/v1\/chats\/lkjsdfsdflkj"
}
],
"avatar":"",
"id":"Zulip Chat: cslkjfd09347kjldf098342",
"email":"",
"name":"",
"deleted":false
},
"message":{
"session":{
"title":"Zulip Chat",
"href":"https:\/\/www.zulipchat.com\/"
},
"person_id":"Zulip Chat: cslkjfd09347kjldf098342",
"data":{
},
"content":"Zulip is awesome!",
"id":"984fde4-86fd-2345-sldk-2sdkfksldff",
"from":"client",
"type":"message",
"timestamp":1541627296072,
"private":false,
"entities":[
]
}
}

View File

@@ -0,0 +1,182 @@
{
"triggeredAlert": {
"id": 28632,
"boundary": "lower",
"value": "3",
"type": "concurrents"
},
"siteDetails": {
"user_id": 81923,
"acct": "GSN-595854-T",
"email": "asdasd@fasdf.com",
"first_name": "sadasd",
"last_name": "",
"site_name": "http://requestb.in/",
"domain": "requestb.in",
"url": "http://requestb.in/",
"timezone": "Australia/Sydney"
},
"snapshot": {
"time": {
"time": 1481952442380,
"local": "2016-12-17T16:27:22+11:00"
},
"concurrents": {
"visitors": 0,
"returning": 0,
"pages": 0,
"active": 0,
"tagged": 0
},
"timeSeries": {
"visitors.total": [{
"time": "2016-12-17T15:57:22+11:00",
"value": 0
}, {
"time": "2016-12-17T15:58:22+11:00",
"value": 0
}, {
"time": "2016-12-17T15:59:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:00:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:01:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:02:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:03:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:04:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:05:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:06:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:07:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:08:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:09:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:10:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:11:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:12:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:13:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:14:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:15:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:16:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:17:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:18:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:19:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:20:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:21:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:22:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:23:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:24:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:25:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:26:22+11:00",
"value": 0
}, {
"time": "2016-12-17T16:27:22+11:00",
"value": 0
}]
},
"pages": {
"list": [],
"cardinality": 0
},
"sources": {
"direct": 0,
"site": {
"list": [],
"visitors": 0,
"cardinality": 0
},
"social": {
"list": [],
"visitors": 0,
"cardinality": 0
},
"organic": {
"list": [],
"visitors": 0,
"cardinality": 0
},
"internal": {
"list": [],
"visitors": 0,
"cardinality": 0
}
},
"engagement": {
"timeOnSite": {
"breakdown": {
"0": 0,
"10": 0,
"30": 0,
"60": 0,
"300": 0,
"900": 0,
"1800": 0
},
"average": 0
},
"visitDepth": {
"breakdown": {
"1": 0,
"2": 0,
"5": 0,
"15": 0,
"30": 0,
"60": 0
},
"detailedBreakdown": {},
"average": 0
}
}
},
"concurrents": 33
}

View File

@@ -0,0 +1,33 @@
from zerver.lib.test_classes import WebhookTestCase
from zerver.webhooks.gosquared.view import CHAT_MESSAGE_TEMPLATE
class GoSquaredHookTests(WebhookTestCase):
# Note: Include a test function per each distinct message condition your integration supports
def test_traffic_message(self) -> None:
expected_topic_name = "GoSquared - requestb.in"
expected_message = (
"[requestb.in](https://www.gosquared.com/now/GSN-595854-T) has 33 visitors online."
)
self.check_webhook(
"traffic_spike",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)
def test_chat_message(self) -> None:
expected_topic_name = "Live chat session - Zulip Chat"
expected_message = CHAT_MESSAGE_TEMPLATE.format(
status="visitor",
name="John Smith",
content="Zulip is awesome!",
)
self.check_webhook(
"chat_message",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)

View File

@@ -0,0 +1,64 @@
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_bool, check_int, check_string
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.models import UserProfile
TRAFFIC_SPIKE_TEMPLATE = "[{website_name}]({website_url}) has {user_num} visitors online."
CHAT_MESSAGE_TEMPLATE = """
The {status} **{name}** messaged:
``` quote
{content}
```
""".strip()
ALL_EVENT_TYPES = ["chat_message", "traffic_spike"]
@webhook_view("GoSquared", all_event_types=ALL_EVENT_TYPES)
@typed_endpoint
def api_gosquared_webhook(
request: HttpRequest,
user_profile: UserProfile,
*,
payload: JsonBodyPayload[WildValue],
) -> HttpResponse:
body = ""
topic_name = ""
# Unfortunately, there is no other way to infer the event type
# than just inferring it from the payload's attributes
# Traffic spike/dip event
if "concurrents" in payload and "siteDetails" in payload:
domain_name = payload["siteDetails"]["domain"].tame(check_string)
user_num = payload["concurrents"].tame(check_int)
user_acc = payload["siteDetails"]["acct"].tame(check_string)
acc_url = "https://www.gosquared.com/now/" + user_acc
body = TRAFFIC_SPIKE_TEMPLATE.format(
website_name=domain_name, website_url=acc_url, user_num=user_num
)
topic_name = f"GoSquared - {domain_name}"
check_send_webhook_message(request, user_profile, topic_name, body, "traffic_spike")
# Live chat message event
elif payload.get("message") is not None and payload.get("person") is not None:
# Only support non-direct messages
if not payload["message"]["private"].tame(check_bool):
session_title = payload["message"]["session"]["title"].tame(check_string)
topic_name = f"Live chat session - {session_title}"
body = CHAT_MESSAGE_TEMPLATE.format(
status=payload["person"]["status"].tame(check_string),
name=payload["person"]["_anon"]["name"].tame(check_string),
content=payload["message"]["content"].tame(check_string),
)
check_send_webhook_message(request, user_profile, topic_name, body, "chat_message")
else:
raise UnsupportedWebhookEventTypeError("unknown_event")
return json_success(request)