From 863dfe39bacf49e50fdade18b2b967d922aad3b7 Mon Sep 17 00:00:00 2001 From: jimmoffet Date: Fri, 7 Oct 2022 17:25:31 -0700 Subject: [PATCH] config flag for turning off inbound SMS replies --- app/config.py | 3 +++ app/notifications/receive_notifications.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/app/config.py b/app/config.py index d64873dad..1564bc467 100644 --- a/app/config.py +++ b/app/config.py @@ -113,6 +113,9 @@ class Config(object): # Firetext API Key FIRETEXT_API_KEY = os.environ.get("FIRETEXT_API_KEY", "placeholder") FIRETEXT_INTERNATIONAL_API_KEY = os.environ.get("FIRETEXT_INTERNATIONAL_API_KEY", "placeholder") + + # Whether to ignore POSTs from SNS for replies to SMS we sent + RECEIVE_INBOUND_SMS = False # Use notify.sandbox.10x sending domain unless overwritten by environment NOTIFY_EMAIL_DOMAIN = 'notify.sandbox.10x.gsa.gov' diff --git a/app/notifications/receive_notifications.py b/app/notifications/receive_notifications.py index e8ff5c892..b1099d00b 100644 --- a/app/notifications/receive_notifications.py +++ b/app/notifications/receive_notifications.py @@ -38,6 +38,12 @@ def receive_sns_sms(): } """ + # Whether or not to ignore inbound SMS replies + if not current_app.config['RECEIVE_INBOUND_SMS']: + return jsonify( + result="success", message="SMS-SNS callback succeeded" + ), 200 + try: post_data = sns_notification_handler(request.data, request.headers) except Exception as e: