Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
api: Add bot name to outgoing webhook payload.
PIG208c6dfe7bf40ee
diff --git a/zerver/lib/outgoing_webhook.py b/zerver/lib/outgoing_webhook.pyindex 19642fa5aa7..13aaf37d0ce 100644--- a/zerver/lib/outgoing_webhook.py+++ b/zerver/lib/outgoing_webhook.py@@ -69,6 +69,7 @@ class GenericOutgoingWebhookService(OutgoingWebhookServiceInterface):"data": event["command"],"message": message_dict,"bot_email": self.user_profile.email,+ "bot_full_name": self.user_profile.full_name,"token": self.token,"trigger": event["trigger"],}diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex 8a4a734097d..83cff00dfac 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -9302,6 +9302,10 @@ paths:type: stringdescription: |Email of the bot user.+ bot_full_name:+ type: string+ description: |+ The full name of the bot user.data:type: stringdescription: |@@ -9376,6 +9380,7 @@ paths:"sender_realm_str": "zulip",},"bot_email": "outgoing-bot@localhost",+ "bot_full_name": "Outgoing webhook test",}/calls/bigbluebutton/create:diff --git a/zerver/tests/test_outgoing_webhook_interfaces.py b/zerver/tests/test_outgoing_webhook_interfaces.pyindex bb4f1318ae2..a7780d5e155 100644--- a/zerver/tests/test_outgoing_webhook_interfaces.py+++ b/zerver/tests/test_outgoing_webhook_interfaces.py@@ -18,10 +18,10 @@ class TestGenericOutgoingWebhookService(ZulipTestCase):def setUp(self) -> None:super().setUp()- bot_user = get_user("[email protected]", get_realm("zulip"))+ self.bot_user = get_user("[email protected]", get_realm("zulip"))service_class = get_service_interface_class("whatever") # GenericOutgoingWebhookServiceself.handler = service_class(- service_name="test-service", token="abcdef", user_profile=bot_user+ service_name="test-service", token="abcdef", user_profile=self.bot_user)def test_process_success_response(self) -> None:@@ -113,6 +113,7 @@ class TestGenericOutgoingWebhookService(ZulipTestCase):request_data = session.post.call_args[1]["json"]validate_against_openapi_schema(request_data, "/zulip-outgoing-webhook", "post", "200")+ self.assertEqual(request_data["bot_full_name"], self.bot_user.full_name)self.assertEqual(request_data["data"], "@**test**")self.assertEqual(request_data["token"], "abcdef")self.assertEqual(request_data["message"], expected_message_data)