mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
This is just a basic Dropbox webhook integration. It just notifies a user when something has changed, it does not specify what changed. Doing so would require storing data, as Dropbox API was created mainly for file managers, not integrations like this. Closes #5672
19 lines
868 B
Python
19 lines
868 B
Python
from typing import Text
|
|
from django.http import HttpRequest, HttpResponse
|
|
from zerver.lib.actions import check_send_stream_message
|
|
from zerver.lib.response import json_success
|
|
from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view
|
|
from zerver.models import UserProfile
|
|
|
|
@api_key_only_webhook_view('Dropbox')
|
|
@has_request_variables
|
|
def api_dropbox_webhook(request: HttpRequest, user_profile: UserProfile,
|
|
stream: Text=REQ(default='test'),
|
|
topic: Text=REQ(default='Dropbox')) -> HttpResponse:
|
|
if request.method == 'GET':
|
|
return HttpResponse(request.GET['challenge'])
|
|
elif request.method == 'POST':
|
|
check_send_stream_message(user_profile, request.client,
|
|
stream, topic, "File has been updated on Dropbox!")
|
|
return json_success()
|