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
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:
0
zerver/webhooks/flock/__init__.py
Normal file
0
zerver/webhooks/flock/__init__.py
Normal file
28
zerver/webhooks/flock/doc.md
Normal file
28
zerver/webhooks/flock/doc.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# Zulip Flock integration
|
||||
|
||||
Get Zulip notifications from your Flock channels.
|
||||
|
||||
{start_tabs}
|
||||
|
||||
1. {!create-an-incoming-webhook.md!}
|
||||
|
||||
1. {!generate-webhook-url-basic.md!}
|
||||
|
||||
1. In Flock, click on **Apps** in the bottom-right corner. Got to the
|
||||
**Admin Panel**, and click on **Webhooks**. Select **Outgoing
|
||||
Webhook**, and click **Add**.
|
||||
|
||||
1. Set **Send messages from a channel** to the Flock channel you'd like
|
||||
to be notified about. Set **Name that the webhook will post as** to a
|
||||
name of your choice, such as `Zulip`. Finally, set **Callback URL**
|
||||
to the URL generated above, and click **Save Settings**.
|
||||
|
||||
{end_tabs}
|
||||
|
||||
{!congrats.md!}
|
||||
|
||||

|
||||
|
||||
### Related documentation
|
||||
|
||||
{!webhooks-url-specification.md!}
|
||||
11
zerver/webhooks/flock/fixtures/messages.json
Normal file
11
zerver/webhooks/flock/fixtures/messages.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "1519889547187_0",
|
||||
"to": "g:183ff1e90d79465793273a31d7d1e537",
|
||||
"from": "u:9qehqo3ixo3t93e3",
|
||||
"text": "This is the welcome message!",
|
||||
"timestamp": "2018-03-01T07:32:25.238Z",
|
||||
"timestampInMillis": 1519889545238,
|
||||
"uid": "1519889545238-gg8-m203",
|
||||
"onBehalfOf": "",
|
||||
"visibleTo": []
|
||||
}
|
||||
26
zerver/webhooks/flock/fixtures/note.json
Normal file
26
zerver/webhooks/flock/fixtures/note.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"attachments": [
|
||||
{
|
||||
"appId": "bd05fb5b1e39e29b396e03c2efe053196e3b9458",
|
||||
"title": "NoteTitle",
|
||||
"forward": true,
|
||||
"views": {
|
||||
"widget": {
|
||||
"src": "https://apps.flock.co:443/flock-notes/notes/8a0fc0c2-e567-4685-a7a7-883898da47c3/preview",
|
||||
"width": 0,
|
||||
"height": 65
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"id": "Amreh",
|
||||
"to": "g:183ff1e90d79465793273a31d7d1e537",
|
||||
"from": "u:9qehqo3ixo3t93e3",
|
||||
"notification": "Shared a note",
|
||||
"text": "",
|
||||
"appId": "bd05fb5b1e39e29b396e03c2efe053196e3b9458",
|
||||
"timestamp": "2018-03-01T08:16:08.335Z",
|
||||
"timestampInMillis": 1519892168335,
|
||||
"uid": "1519892168335-y7J-m203",
|
||||
"onBehalfOf": ""
|
||||
}
|
||||
17
zerver/webhooks/flock/fixtures/pinned.json
Normal file
17
zerver/webhooks/flock/fixtures/pinned.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"id": "SMzzJ",
|
||||
"to": "g:183ff1e90d79465793273a31d7d1e537",
|
||||
"from": "u:9qehqo3ixo3t93e3",
|
||||
"notification": "Rishabh rawat pinned an item to the conversation",
|
||||
"flockml": "<flockml>Rishabh rawat pinned an <action id='act1' type='openWidget' url='https://apps-static.flock.co/smartbar/index.html' desktopType='sidebar' mobileType='modal'>item</action> to this conversation. You can access it via the <action id='act1' type='openWidget' url='https://apps-static.flock.co/smartbar/index.html' desktopType='sidebar' mobileType='modal'>Files</action> App.</flockml>",
|
||||
"text": "",
|
||||
"sendAs": {
|
||||
"name": "Pinner Bot",
|
||||
"profileImage": "https://apps-static.flock.co/smartbar/bot-icon.png"
|
||||
},
|
||||
"appId": "6937451c-edbf-4ecb-b715-1e26574b5168",
|
||||
"timestamp": "2018-03-01T07:49:06.284Z",
|
||||
"timestampInMillis": 1519890546284,
|
||||
"uid": "1519890546284-f3t-m203",
|
||||
"onBehalfOf": ""
|
||||
}
|
||||
40
zerver/webhooks/flock/fixtures/reminder.json
Normal file
40
zerver/webhooks/flock/fixtures/reminder.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"attachments": [
|
||||
{
|
||||
"id": "3d5774d9-ec8e-4664-9286-c54d0034e401",
|
||||
"appId": "905f9943396442448b5d259d72c6d5fe",
|
||||
"title": "FlockBot undefined in mychannel: Hey ",
|
||||
"color": "#efb80b",
|
||||
"forward": false,
|
||||
"buttons": [
|
||||
{
|
||||
"name": "Snooze for me",
|
||||
"icon": "https://apps-static.flock.co/reminder/snooze.svg",
|
||||
"action": {
|
||||
"mobileType": "modal",
|
||||
"type": "openWidget",
|
||||
"desktopType": "modal",
|
||||
"url": "https://apps-static.flock.co/reminder3/production/html/snooze.html",
|
||||
"width": 570,
|
||||
"height": 270,
|
||||
"sendContext": false
|
||||
},
|
||||
"id": "22841"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"id": "wzXJN",
|
||||
"to": "g:183ff1e90d79465793273a31d7d1e537",
|
||||
"from": "u:Bu4v779hlh4uuug5",
|
||||
"text": "Rishabh rawat wanted me to remind All",
|
||||
"sendAs": {
|
||||
"name": "Reminder Bot",
|
||||
"profileImage": "https://apps-static.flock.co/reminder/reminder-bot.png"
|
||||
},
|
||||
"appId": "905f9943396442448b5d259d72c6d5fe",
|
||||
"timestamp": "2018-03-01T08:00:03.587Z",
|
||||
"timestampInMillis": 1519891203587,
|
||||
"uid": "1519891203587-Nhj-m201",
|
||||
"onBehalfOf": "u:9qehqo3ixo3t93e3"
|
||||
}
|
||||
20
zerver/webhooks/flock/fixtures/reply.json
Normal file
20
zerver/webhooks/flock/fixtures/reply.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"attachments": [
|
||||
{
|
||||
"appId": "7d7d0856-f0a1-45bc-a66e-8c9ed504e620",
|
||||
"title": "in reply to Rishabh R",
|
||||
"description": "This is the welcome message!",
|
||||
"color": "#0BBE51",
|
||||
"forward": false
|
||||
}
|
||||
],
|
||||
"id": "BPsjQ",
|
||||
"to": "g:183ff1e90d79465793273a31d7d1e537",
|
||||
"from": "u:9qehqo3ixo3t93e3",
|
||||
"text": "It's interesting how high productivity will go...",
|
||||
"appId": "7d7d0856-f0a1-45bc-a66e-8c9ed504e620",
|
||||
"timestamp": "2018-03-01T07:44:45.493Z",
|
||||
"timestampInMillis": 1519890285493,
|
||||
"uid": "1519890285493-eed-m203",
|
||||
"onBehalfOf": ""
|
||||
}
|
||||
20
zerver/webhooks/flock/fixtures/reply_note.json
Normal file
20
zerver/webhooks/flock/fixtures/reply_note.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"attachments": [
|
||||
{
|
||||
"appId": "7d7d0856-f0a1-45bc-a66e-8c9ed504e620",
|
||||
"title": "in reply to Rishabh R",
|
||||
"description": "NoteTitle",
|
||||
"color": "#0BBE51",
|
||||
"forward": false
|
||||
}
|
||||
],
|
||||
"id": "WPDlW",
|
||||
"to": "g:183ff1e90d79465793273a31d7d1e537",
|
||||
"from": "u:9qehqo3ixo3t93e3",
|
||||
"text": "This is reply to Note.",
|
||||
"appId": "7d7d0856-f0a1-45bc-a66e-8c9ed504e620",
|
||||
"timestamp": "2018-03-01T08:16:57.793Z",
|
||||
"timestampInMillis": 1519892217793,
|
||||
"uid": "1519892217793-lt2-m203",
|
||||
"onBehalfOf": ""
|
||||
}
|
||||
20
zerver/webhooks/flock/fixtures/reply_pinned.json
Normal file
20
zerver/webhooks/flock/fixtures/reply_pinned.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"attachments": [
|
||||
{
|
||||
"appId": "7d7d0856-f0a1-45bc-a66e-8c9ed504e620",
|
||||
"title": "in reply to Rishabh R",
|
||||
"description": "Rishabh rawat pinned an item to this conversation. You can access it via the Files",
|
||||
"color": "#0BBE51",
|
||||
"forward": false
|
||||
}
|
||||
],
|
||||
"id": "QPJia",
|
||||
"to": "g:183ff1e90d79465793273a31d7d1e537",
|
||||
"from": "u:9qehqo3ixo3t93e3",
|
||||
"text": "This is reply to pinned message.",
|
||||
"appId": "7d7d0856-f0a1-45bc-a66e-8c9ed504e620",
|
||||
"timestamp": "2018-03-01T08:11:46.549Z",
|
||||
"timestampInMillis": 1519891906549,
|
||||
"uid": "1519891906549-rzZ-m203",
|
||||
"onBehalfOf": ""
|
||||
}
|
||||
20
zerver/webhooks/flock/fixtures/reply_reminder.json
Normal file
20
zerver/webhooks/flock/fixtures/reply_reminder.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"attachments": [
|
||||
{
|
||||
"appId": "7d7d0856-f0a1-45bc-a66e-8c9ed504e620",
|
||||
"title": "in reply to Reminders B",
|
||||
"description": "Rishabh rawat wanted me to remind All",
|
||||
"color": "#0BBE51",
|
||||
"forward": false
|
||||
}
|
||||
],
|
||||
"id": "Oprnr",
|
||||
"to": "g:183ff1e90d79465793273a31d7d1e537",
|
||||
"from": "u:9qehqo3ixo3t93e3",
|
||||
"text": "This is a reply to Reminder.",
|
||||
"appId": "7d7d0856-f0a1-45bc-a66e-8c9ed504e620",
|
||||
"timestamp": "2018-03-01T08:14:17.985Z",
|
||||
"timestampInMillis": 1519892057985,
|
||||
"uid": "1519892057985-B1f-m203",
|
||||
"onBehalfOf": ""
|
||||
}
|
||||
20
zerver/webhooks/flock/fixtures/reply_todo.json
Normal file
20
zerver/webhooks/flock/fixtures/reply_todo.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"attachments": [
|
||||
{
|
||||
"appId": "7d7d0856-f0a1-45bc-a66e-8c9ed504e620",
|
||||
"title": "in reply to To-do bot",
|
||||
"description": "Study for end term exams.",
|
||||
"color": "#0BBE51",
|
||||
"forward": false
|
||||
}
|
||||
],
|
||||
"id": "WoBGB",
|
||||
"to": "g:183ff1e90d79465793273a31d7d1e537",
|
||||
"from": "u:9qehqo3ixo3t93e3",
|
||||
"text": "This is a reply to Todo notification.",
|
||||
"appId": "7d7d0856-f0a1-45bc-a66e-8c9ed504e620",
|
||||
"timestamp": "2018-03-01T08:13:24.950Z",
|
||||
"timestampInMillis": 1519892004950,
|
||||
"uid": "1519892004950-1re-m203",
|
||||
"onBehalfOf": ""
|
||||
}
|
||||
49
zerver/webhooks/flock/fixtures/todo.json
Normal file
49
zerver/webhooks/flock/fixtures/todo.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"attachments": [
|
||||
{
|
||||
"id": "todo_attachment",
|
||||
"appId": "6d0aa37b00944ec0a7426d34ca2df048",
|
||||
"color": "#2A83Fc",
|
||||
"views": {
|
||||
"flockml": "<flockml>Study for end term exams.</flockml>"
|
||||
},
|
||||
"buttons": [
|
||||
{
|
||||
"name": "View",
|
||||
"action": {
|
||||
"mobileType": "modal",
|
||||
"type": "openWidget",
|
||||
"desktopType": "sidebar",
|
||||
"url": "https://apps-static.flock.co/todo/index.html?type=chat&chat&chatName=mychannel&listId=li%3Ac5f13a8a-e90a-4396-b810-1cfe85ef7c31&todoId=to%3Ab4273700-ac8c-44d0-91a3-d13d3d11e500",
|
||||
"sendContext": false
|
||||
},
|
||||
"id": "view"
|
||||
},
|
||||
{
|
||||
"name": "Mark as done",
|
||||
"icon": "https://apps-static.flock.com/todo/markasdone.svg",
|
||||
"action": {
|
||||
"type": "sendEvent",
|
||||
"sendContext": false
|
||||
},
|
||||
"id": "complete;g:183ff1e90d79465793273a31d7d1e537;li:c5f13a8a-e90a-4396-b810-1cfe85ef7c31;to:b4273700-ac8c-44d0-91a3-d13d3d11e500"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"id": "LrAbZ",
|
||||
"to": "g:183ff1e90d79465793273a31d7d1e537",
|
||||
"from": "u:Bgcq3pt33pqpllbt",
|
||||
"notification": "Rishabh rawat added a to-do in New List 1 list",
|
||||
"flockml": "<flockml>Rishabh rawat added a to-do in New List 1 list</flockml>",
|
||||
"text": "",
|
||||
"sendAs": {
|
||||
"name": "To-do bot",
|
||||
"profileImage": "https://apps-static.flock.com/todo/todoboticon.png"
|
||||
},
|
||||
"appId": "6d0aa37b00944ec0a7426d34ca2df048",
|
||||
"timestamp": "2018-03-01T07:56:41.413Z",
|
||||
"timestampInMillis": 1519891001413,
|
||||
"uid": "1519891001413-vNe-m201",
|
||||
"onBehalfOf": "u:9qehqo3ixo3t93e3"
|
||||
}
|
||||
73
zerver/webhooks/flock/tests.py
Normal file
73
zerver/webhooks/flock/tests.py
Normal file
@@ -0,0 +1,73 @@
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class FlockHookTests(WebhookTestCase):
|
||||
def test_flock_message(self) -> None:
|
||||
expected_topic_name = "Flock notifications"
|
||||
expected_message = "This is the welcome message!"
|
||||
self.check_webhook(
|
||||
"messages", expected_topic_name, expected_message, content_type="application/json"
|
||||
)
|
||||
|
||||
def test_flock_reply(self) -> None:
|
||||
expected_topic_name = "Flock notifications"
|
||||
expected_message = "It's interesting how high productivity will go..."
|
||||
self.check_webhook(
|
||||
"reply", expected_topic_name, expected_message, content_type="application/json"
|
||||
)
|
||||
|
||||
def test_flock_note(self) -> None:
|
||||
expected_topic_name = "Flock notifications"
|
||||
expected_message = "Shared a note"
|
||||
self.check_webhook(
|
||||
"note", expected_topic_name, expected_message, content_type="application/json"
|
||||
)
|
||||
|
||||
def test_flock_reply_note(self) -> None:
|
||||
expected_topic_name = "Flock notifications"
|
||||
expected_message = "This is reply to Note."
|
||||
self.check_webhook(
|
||||
"reply_note", expected_topic_name, expected_message, content_type="application/json"
|
||||
)
|
||||
|
||||
def test_flock_reply_pinned(self) -> None:
|
||||
expected_topic_name = "Flock notifications"
|
||||
expected_message = "This is reply to pinned message."
|
||||
self.check_webhook(
|
||||
"reply_pinned", expected_topic_name, expected_message, content_type="application/json"
|
||||
)
|
||||
|
||||
def test_flock_reply_reminder(self) -> None:
|
||||
expected_topic_name = "Flock notifications"
|
||||
expected_message = "This is a reply to Reminder."
|
||||
self.check_webhook(
|
||||
"reply_reminder", expected_topic_name, expected_message, content_type="application/json"
|
||||
)
|
||||
|
||||
def test_flock_reply_todo(self) -> None:
|
||||
expected_topic_name = "Flock notifications"
|
||||
expected_message = "This is a reply to Todo notification."
|
||||
self.check_webhook(
|
||||
"reply_todo", expected_topic_name, expected_message, content_type="application/json"
|
||||
)
|
||||
|
||||
def test_flock_pinned(self) -> None:
|
||||
expected_topic_name = "Flock notifications"
|
||||
expected_message = "Rishabh rawat pinned an item to the conversation"
|
||||
self.check_webhook(
|
||||
"pinned", expected_topic_name, expected_message, content_type="application/json"
|
||||
)
|
||||
|
||||
def test_flock_reminder(self) -> None:
|
||||
expected_topic_name = "Flock notifications"
|
||||
expected_message = "Rishabh rawat wanted me to remind All"
|
||||
self.check_webhook(
|
||||
"reminder", expected_topic_name, expected_message, content_type="application/json"
|
||||
)
|
||||
|
||||
def test_flock_todo(self) -> None:
|
||||
expected_topic_name = "Flock notifications"
|
||||
expected_message = "Rishabh rawat added a to-do in New List 1 list"
|
||||
self.check_webhook(
|
||||
"todo", expected_topic_name, expected_message, content_type="application/json"
|
||||
)
|
||||
31
zerver/webhooks/flock/view.py
Normal file
31
zerver/webhooks/flock/view.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# Webhooks for external integrations.
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import webhook_view
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.typed_endpoint import JsonBodyPayload, typed_endpoint
|
||||
from zerver.lib.validator import WildValue, check_string
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
@webhook_view("Flock")
|
||||
@typed_endpoint
|
||||
def api_flock_webhook(
|
||||
request: HttpRequest,
|
||||
user_profile: UserProfile,
|
||||
*,
|
||||
payload: JsonBodyPayload[WildValue],
|
||||
) -> HttpResponse:
|
||||
text = payload["text"].tame(check_string)
|
||||
if len(text) != 0:
|
||||
message_body = text
|
||||
else:
|
||||
message_body = payload["notification"].tame(check_string)
|
||||
|
||||
topic_name = "Flock notifications"
|
||||
body = f"{message_body}"
|
||||
|
||||
check_send_webhook_message(request, user_profile, topic_name, body)
|
||||
|
||||
return json_success(request)
|
||||
Reference in New Issue
Block a user