Skip to content

Commit 4154470

Browse files
committed
slack bridge: Add logic to prevent looping messages.
When using Slack Webhook integration to get messages from Slack to Zulip, we don't want to send back messages from the Slack integration bot. Fixes #825.
1 parent 79b7a2a commit 4154470

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

zulip/integrations/bridge_with_slack/bridge_with_slack_config.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"email": "[email protected]",
44
"api_key": "put api key here",
55
"site": "https://chat.zulip.org",
6+
"integration_bot_email": "[email protected]",
67
},
78
"slack": {
89
"username": "slack_username",

zulip/integrations/bridge_with_slack/run-slack-bridge

+2-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ class SlackBridge:
101101
slack_channel = get_slack_channel_for_zulip_message(
102102
msg, self.zulip_to_slack_map, self.zulip_config["email"]
103103
)
104-
if slack_channel is not None:
104+
is_from_slack = msg["sender_email"] == self.zulip_config.get("integration_bot_email")
105+
if slack_channel is not None and not is_from_slack:
105106
self.wrap_slack_mention_with_bracket(msg)
106107
slack_text = SLACK_MESSAGE_TEMPLATE.format(
107108
username=msg["sender_full_name"], message=msg["content"]

0 commit comments

Comments
 (0)