diff --git a/matrix_webhook/formatters/alertmanager.py b/matrix_webhook/formatters/alertmanager.py new file mode 100644 index 0000000..45f834c --- /dev/null +++ b/matrix_webhook/formatters/alertmanager.py @@ -0,0 +1,8 @@ + +def formatter(data, headers): + """Pretty-print an alertmanager notification.""" + text = "" + for alert in data['alerts']: + text += f"[{alert['status']}] - {alert['labels']['summary']}\n\n" + data["body"] = text + return data