diff --git a/templates/zerver/integrations.html b/templates/zerver/integrations.html
index 3238cedcf3..38d9bf98cb 100644
--- a/templates/zerver/integrations.html
+++ b/templates/zerver/integrations.html
@@ -83,9 +83,14 @@
Choose the POST hook from the list presented and click "Add hook." Make sure to replace the @ in the bot's email address with %40,
as Bitbucket will not execute the hook if the username contains a @.
In the URL field, enter https://bot_email:bot_api_key@api.zulip.com/v1/external/bitbucket:
In the URL field, enter https://bot_email:bot_api_key@api.zulip.com/v1/external/bitbucket:
+ By default, notifications are sent to
+ the commits stream. To send notifications to a
+ different stream, append ?stream=stream_name to
+ the URL. The stream must already exist.
Congratulations! You're done!
Whenever you push code to your repository,
you'll get an automated notification that looks like this:
diff --git a/zerver/views.py b/zerver/views.py
index 68c4721e72..b09563ecfe 100644
--- a/zerver/views.py
+++ b/zerver/views.py
@@ -2088,7 +2088,8 @@ def get_status_list(requesting_user_profile):
@authenticated_rest_api_view
@has_request_variables
-def api_bitbucket_webhook(request, user_profile, payload=REQ(converter=json_to_dict)):
+def api_bitbucket_webhook(request, user_profile, payload=REQ(converter=json_to_dict),
+ stream=REQ(default='commits')):
repository = payload['repository']
commits = [{'id': commit['raw_node'], 'message': commit['message'],
'url': '%s%scommits/%s' % (payload['canon_url'],
@@ -2108,7 +2109,7 @@ def api_bitbucket_webhook(request, user_profile, payload=REQ(converter=json_to_d
None, payload['user'])
subject = elide_subject(subject)
- check_send_message(user_profile, get_client("API"), "stream", ["commits"], subject, content)
+ check_send_message(user_profile, get_client("API"), "stream", [stream], subject, content)
return json_success()
@authenticated_json_post_view