From 45fa7a5370db21341497d016faad4e9a38f83222 Mon Sep 17 00:00:00 2001 From: Becky Smith Date: Wed, 20 Sep 2023 15:08:58 +0100 Subject: [PATCH] Notify data team for import failures --- environment-sample | 1 + openprescribing/openprescribing/settings/base.py | 4 +--- openprescribing/openprescribing/slack.py | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/environment-sample b/environment-sample index 143a621eec..a129c0b706 100644 --- a/environment-sample +++ b/environment-sample @@ -39,6 +39,7 @@ GUNICORN_NUM_WORKERS=6 GUNICORN_LOG_LEVEL=warn SLACK_TECHNOISE_POST_KEY=slack_technoise_post_key +SLACK_DATATEAM_POST_KEY=slack_datateam_post_key CF_API_KEY=cf_api_key CF_API_EMAIL=cf_api_email diff --git a/openprescribing/openprescribing/settings/base.py b/openprescribing/openprescribing/settings/base.py index 850c1ed678..715d951ca5 100644 --- a/openprescribing/openprescribing/settings/base.py +++ b/openprescribing/openprescribing/settings/base.py @@ -345,9 +345,7 @@ # Webhook URLs for posting to different channels can be configured at # https://api.slack.com/apps/A6B85C8KC/incoming-webhooks SLACK_TECHNOISE_POST_KEY = utils.get_env_setting("SLACK_TECHNOISE_POST_KEY", default="") -SLACK_TECHSUPPORT_POST_KEY = utils.get_env_setting( - "SLACK_TECHSUPPORT_POST_KEY", default="" -) +SLACK_DATATEAM_POST_KEY = utils.get_env_setting("SLACK_DATATEAM_POST_KEY", default="") SLACK_SENDING_ACTIVE = True diff --git a/openprescribing/openprescribing/slack.py b/openprescribing/openprescribing/slack.py index aa30914b45..b7b0b1c28f 100644 --- a/openprescribing/openprescribing/slack.py +++ b/openprescribing/openprescribing/slack.py @@ -11,13 +11,13 @@ def notify_slack(message, is_error=False): return webhook_url = settings.SLACK_TECHNOISE_POST_KEY - techsupport_webhook_url = settings.SLACK_TECHSUPPORT_POST_KEY + datateam_webhook_url = settings.SLACK_DATATEAM_POST_KEY slack_data = {"text": message} response = requests.post(webhook_url, json=slack_data) if is_error: - # Also post error messages to tech-support - response = requests.post(techsupport_webhook_url, json=slack_data) + # Also post error messages to #team-data + response = requests.post(datateam_webhook_url, json=slack_data) if response.status_code != 200: raise ValueError(