Skip to content

Commit

Permalink
slack bridge: Add logic to prevent looping messages.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
PieterCK committed Jun 22, 2024
1 parent 5ae8f99 commit 10bcf4f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"email": "zulip-bot@email.com",
"api_key": "put api key here",
"site": "https://chat.zulip.org",
"integration_bot_email": "slack-bot@zulip.com",
},
"slack": {
"username": "slack_username",
Expand Down
3 changes: 2 additions & 1 deletion zulip/integrations/bridge_with_slack/run-slack-bridge
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ class SlackBridge:
slack_channel = get_slack_channel_for_zulip_message(
msg, self.zulip_to_slack_map, self.zulip_config["email"]
)
if slack_channel is not None:
is_from_slack = msg["sender_email"] == self.zulip_config.get("integration_bot_email")
if slack_channel is not None and not is_from_slack:
self.wrap_slack_mention_with_bracket(msg)
slack_text = SLACK_MESSAGE_TEMPLATE.format(
username=msg["sender_full_name"], message=msg["content"]
Expand Down

0 comments on commit 10bcf4f

Please sign in to comment.