Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
slack_integration: Convert integration bot messages.
PieterCKf0194c0963fc
diff --git a/zerver/webhooks/slack/tests.py b/zerver/webhooks/slack/tests.pyindex 679a006a117..80603e8b259 100644--- a/zerver/webhooks/slack/tests.py+++ b/zerver/webhooks/slack/tests.py@@ -302,12 +302,15 @@ class SlackWebhookTests(WebhookTestCase):@mock_slack_api_callsdef test_message_from_slack_integration_bot(self) -> None:+ message_body = "**Task status changed** from `complete` to `to do`"+ # The integration message is from Slack's ClickUp webhook integration.+ expected_message = EXPECTED_MESSAGE.format(user="ClickUp", message=message_body)+self.check_webhook("message_from_slack_integration_bot",- "",- "",+ EXPECTED_TOPIC,+ expected_message,content_type="application/json",- expect_noop=True,)@mock_slack_api_callsdiff --git a/zerver/webhooks/slack/view.py b/zerver/webhooks/slack/view.pyindex 55f3396d58d..42296104d37 100644--- a/zerver/webhooks/slack/view.py+++ b/zerver/webhooks/slack/view.py@@ -267,15 +267,13 @@ def api_slack_webhook(user_id = event_dict.get("user").tame(check_none_or(check_string))if user_id is None:# This is likely a Slack integration bot message. The sender of these- # messages doesn't have a user profile and would require additional- # formatting to handle. Refer to the Slack Incoming Webhook integration- # for how to add support for this type of payload.- raise UnsupportedWebhookEventTypeError(- "integration bot message"- if event_dict["subtype"].tame(check_string) == "bot_message"- else "unknown Slack event"- )- sender = get_slack_sender_name(user_id, slack_app_token)+ # messages doesn't have a user profile.+ # TODO: This class of message typically use more Slack blocks and+ # attachments, which the Slack webhook integration currently doesn't+ # support.+ sender = event_dict["username"].tame(check_string)+ else:+ sender = get_slack_sender_name(user_id, slack_app_token)content = get_message_body(text, sender, files)# channels_map_to_topics=0 is ported to use PresetUrlOption.CHANNEL_MAPPING