diff --git a/src/sentry/integrations/slack/notify_action.py b/src/sentry/integrations/slack/notify_action.py index ca3e31aa6ae951..06f63450aec92c 100644 --- a/src/sentry/integrations/slack/notify_action.py +++ b/src/sentry/integrations/slack/notify_action.py @@ -53,7 +53,11 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self._pending_save = False def clean(self) -> Mapping[str, Any]: - channel_id = self.data.get("inputChannelId") or self.data.get("input_channel_id") + channel_id = ( + self.data.get("inputChannelId") + or self.data.get("input_channel_id") + or self.data.get("channel_id") + ) if channel_id: logger.info( "rule.slack.provide_channel_id", diff --git a/tests/sentry/api/endpoints/test_project_rule_details.py b/tests/sentry/api/endpoints/test_project_rule_details.py index 247d0a2a610d79..23c1e7828cf7d3 100644 --- a/tests/sentry/api/endpoints/test_project_rule_details.py +++ b/tests/sentry/api/endpoints/test_project_rule_details.py @@ -411,6 +411,7 @@ def test_update_channel_slack(self): ) actions[0]["channel"] = "#new_channel_name" + actions[0]["channel_id"] = "new_channel_id" url = reverse( "sentry-api-0-project-rule-details", @@ -436,6 +437,13 @@ def test_update_channel_slack(self): content_type="application/json", body=json.dumps(channels), ) + responses.add( + method=responses.GET, + url="https://slack.com/api/conversations.info", + status=200, + content_type="application/json", + body=json.dumps({"ok": channels["ok"], "channel": channels["channels"][1]}), + ) response = self.client.put( url, @@ -502,14 +510,20 @@ def test_update_channel_slack_workspace_fail(self): {"name": "new_channel_name", "id": "new_channel_id"}, ], } - responses.add( method=responses.GET, - url="https://slack.com/api/channels.list", + url="https://slack.com/api/conversations.list", status=200, content_type="application/json", body=json.dumps(channels), ) + responses.add( + method=responses.GET, + url="https://slack.com/api/conversations.info", + status=200, + content_type="application/json", + body=json.dumps({"ok": channels["ok"], "channel": channels["channels"][0]}), + ) response = self.client.put( url, @@ -574,7 +588,7 @@ def test_slack_channel_id_saved(self): "name": "Send a notification to the funinthesun Slack workspace to #team-team-team and show tags [] in notification", "workspace": integration.id, "channel": "#team-team-team", - "input_channel_id": "CSVK0921", + "channel_id": "CSVK0921", } ], "conditions": [