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/dropbox/__init__.py
Normal file
0
zerver/webhooks/dropbox/__init__.py
Normal file
34
zerver/webhooks/dropbox/doc.md
Normal file
34
zerver/webhooks/dropbox/doc.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# Zulip Dropbox integration
|
||||
|
||||
Get Dropbox notifications in Zulip!
|
||||
|
||||
{start_tabs}
|
||||
|
||||
1. {!create-an-incoming-webhook.md!}
|
||||
|
||||
1. {!generate-webhook-url-basic.md!}
|
||||
|
||||
1. Go to your [Dropbox apps page](https://www.dropbox.com/developers/apps),
|
||||
and select **Create app** near the top-right corner. Follow the on-screen
|
||||
instructions to create an app.
|
||||
|
||||
1. Once you've created the app, you will be redirected to the **Settings**
|
||||
tab for your app. Scroll down to the **Webhooks** section.
|
||||
|
||||
1. Go to the **Oauth 2** section, at the bottom of which you'll find a
|
||||
**Generate** button. Click on it to activate the app for your account.
|
||||
|
||||

|
||||
|
||||
1. Set **Webhook URIs** to the URL generated above, and select **Add**.
|
||||
The status of the webhook should say **Enabled**.
|
||||
|
||||
{end_tabs}
|
||||
|
||||
{!congrats.md!}
|
||||
|
||||

|
||||
|
||||
### Related documentation
|
||||
|
||||
{!webhooks-url-specification.md!}
|
||||
12
zerver/webhooks/dropbox/fixtures/file_updated.json
Normal file
12
zerver/webhooks/dropbox/fixtures/file_updated.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"list_folder": {
|
||||
"accounts": [
|
||||
"dbid:AAH4f99T0taONIb-OurWxbNQ6ywGRopQngc"
|
||||
]
|
||||
},
|
||||
"delta": {
|
||||
"users": [
|
||||
12345678
|
||||
]
|
||||
}
|
||||
}
|
||||
27
zerver/webhooks/dropbox/tests.py
Normal file
27
zerver/webhooks/dropbox/tests.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class DropboxHookTests(WebhookTestCase):
|
||||
def test_file_updated(self) -> None:
|
||||
expected_topic_name = "Dropbox"
|
||||
expected_message = "File has been updated on Dropbox!"
|
||||
|
||||
self.check_webhook(
|
||||
"file_updated",
|
||||
expected_topic_name,
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_verification_request(self) -> None:
|
||||
self.subscribe(self.test_user, self.channel_name)
|
||||
get_params = {"stream_name": self.channel_name, "api_key": self.test_user.api_key}
|
||||
result = self.client_get(self.url, get_params)
|
||||
self.assert_json_error(result, "Missing 'challenge' argument", 400)
|
||||
|
||||
get_params["challenge"] = "9B2SVL4orbt5DxLMqJHI6pOTipTqingt2YFMIO0g06E"
|
||||
result = self.client_get(self.url, get_params)
|
||||
|
||||
self.assertEqual(result.status_code, 200)
|
||||
self.assertEqual(result["Content-Type"], "text/plain; charset=UTF-8")
|
||||
self.assert_in_response("9B2SVL4orbt5DxLMqJHI6pOTipTqingt2YFMIO0g06E", result)
|
||||
28
zerver/webhooks/dropbox/view.py
Normal file
28
zerver/webhooks/dropbox/view.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import webhook_view
|
||||
from zerver.lib.request import RequestVariableMissingError
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.typed_endpoint import typed_endpoint
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
@webhook_view("Dropbox", notify_bot_owner_on_invalid_json=False)
|
||||
@typed_endpoint
|
||||
def api_dropbox_webhook(
|
||||
request: HttpRequest,
|
||||
user_profile: UserProfile,
|
||||
*,
|
||||
challenge: str | None = None,
|
||||
) -> HttpResponse:
|
||||
if request.method == "POST":
|
||||
topic_name = "Dropbox"
|
||||
check_send_webhook_message(
|
||||
request, user_profile, topic_name, "File has been updated on Dropbox!"
|
||||
)
|
||||
return json_success(request)
|
||||
else:
|
||||
if challenge is None:
|
||||
raise RequestVariableMissingError("challenge")
|
||||
return HttpResponse(challenge, content_type="text/plain; charset=UTF-8")
|
||||
Reference in New Issue
Block a user