From adfd990232ab39fb46f1c3ce2ca273ea2daeea07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthieu=20Barth=C3=A9lemy?= Date: Wed, 10 Aug 2016 01:52:18 -0500 Subject: [PATCH] Slack: Fix #2393 - Enable markdown parsing when using custom messsage color (#2626) --- lib/ansible/modules/extras/notification/slack.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/notification/slack.py b/lib/ansible/modules/extras/notification/slack.py index 40def3788a8..2ac609d451f 100644 --- a/lib/ansible/modules/extras/notification/slack.py +++ b/lib/ansible/modules/extras/notification/slack.py @@ -171,7 +171,8 @@ def build_payload_for_slack(module, text, channel, username, icon_url, icon_emoj if color == "normal" and text is not None: payload = dict(text=text) elif text is not None: - payload = dict(attachments=[dict(text=text, color=color)]) + # With a custom color we have to set the message as attachment, and explicitely turn markdown parsing on for it. + payload = dict(attachments=[dict(text=text, color=color, mrkdwn_in=["text"])]) if channel is not None: if (channel[0] == '#') or (channel[0] == '@'): payload['channel'] = channel