diff --git a/changelogs/fragments/5019-slack-support-more-groups.yml b/changelogs/fragments/5019-slack-support-more-groups.yml new file mode 100644 index 0000000000..184bab353a --- /dev/null +++ b/changelogs/fragments/5019-slack-support-more-groups.yml @@ -0,0 +1,2 @@ +bugfixes: + - slack - fix incorrect channel prefix ``#`` caused by incomplete pattern detection by adding ``G0`` and ``GF`` as channel ID patterns (https://github.com/ansible-collections/community.general/pull/5019). \ No newline at end of file diff --git a/plugins/modules/notification/slack.py b/plugins/modules/notification/slack.py index bdc839f9a8..f10d4003d6 100644 --- a/plugins/modules/notification/slack.py +++ b/plugins/modules/notification/slack.py @@ -293,7 +293,7 @@ def build_payload_for_slack(text, channel, thread_id, username, icon_url, icon_e # With a custom color we have to set the message as attachment, and explicitly turn markdown parsing on for it. payload = dict(attachments=[dict(text=escape_quotes(text), color=color, mrkdwn_in=["text"])]) if channel is not None: - if channel.startswith(('#', '@', 'C0')): + if channel.startswith(('#', '@', 'C0', 'GF', 'G0')): payload['channel'] = channel else: payload['channel'] = '#' + channel