Skip to content

Commit 81ffb46

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 3ec3c34 commit 81ffb46

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
@@ -89,7 +89,8 @@ class SlackBridge:
8989
slack_channel = get_slack_channel_for_zulip_message(
9090
msg, self.zulip_to_slack_map, self.zulip_config["email"]
9191
)
92-
if slack_channel is not None:
92+
is_from_slack = msg["sender_email"] == self.zulip_config.get("integration_bot_email")
93+
if slack_channel is not None and not is_from_slack:
9394
self.wrap_slack_mention_with_bracket(msg)
9495
slack_text = SLACK_MESSAGE_TEMPLATE.format(
9596
username=msg["sender_full_name"], message=msg["content"]

0 commit comments

Comments
 (0)