SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 3a7f4863 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

send mailgun slack alert only with perm failure

parent a5a48389
No related branches found
No related tags found
No related merge requests found
......@@ -41,15 +41,16 @@ def send_mailgun_alert_slack_message(event_data: dict):
if "scipost" in recipient and error_contains_keyword:
return
message = f"[{event.upper()} / {reason}] {subject}\n{sender} -> {recipient}\nError: {error_description}"
if event == "failed" and (event_data.get("severity", "unknown") == "permanent"):
message = f"[{event.upper()} / {reason}] {subject}\n{sender} -> {recipient}\nError: {error_description}"
response = requests.post(
settings.SLACK_WEBHOOK_URL_MAILGUN_ALERTS,
json={"text": message},
headers={"Content-type": "application/json"},
)
response = requests.post(
settings.SLACK_WEBHOOK_URL_MAILGUN_ALERTS,
json={"text": message},
headers={"Content-type": "application/json"},
)
return response
return response
@csrf_exempt
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment