From 3310cbe2db817a6202850a9636e724af57e6dca9 Mon Sep 17 00:00:00 2001 From: Ryan Lucas Date: Sat, 12 Jan 2019 10:33:47 -0800 Subject: [PATCH] Loading incoming event into dictionary if from Cloudwatch. (#24) --- functions/notify_slack.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/notify_slack.py b/functions/notify_slack.py index 9b34e519..d6a7fad9 100644 --- a/functions/notify_slack.py +++ b/functions/notify_slack.py @@ -59,7 +59,8 @@ def notify_slack(message, region): "icon_emoji": slack_emoji, "attachments": [] } - if "AlarmName" in message: + if "AlarmName" in message: # Incoming event is from Cloudwatch + message = json.loads(message) notification = cloudwatch_notification(message, region) payload['text'] = "AWS CloudWatch notification - " + message["AlarmName"] payload['attachments'].append(notification)