Skip to content

Commit

Permalink
add back opt out
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Kehl committed Dec 18, 2024
1 parent 48c3ceb commit 2c2ee41
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/clients/cloudwatch/aws_cloudwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,23 @@ def _get_log(self, log_group_name, start, end):
break
return all_log_events

def warn_if_dev_is_opted_out(self, provider_response, notification_id):
if (
"is opted out" in provider_response.lower()
or "has blocked sms" in provider_response.lower()
):
if os.getenv("NOTIFY_ENVIRONMENT") in ["development", "test"]:
ansi_red = "\033[31m"
ansi_reset = "\033[0m"
logline = (
ansi_red
+ f"The phone number for notification_id {notification_id} is OPTED OUT. You need to opt back in"
+ ansi_reset
)
current_app.logger.warning(logline)
return logline
return None

def _extract_account_number(self, ses_domain_arn):
account_number = ses_domain_arn.split(":")
return account_number
Expand Down

0 comments on commit 2c2ee41

Please sign in to comment.