twilio small cleanup
Build, push image, and notify Watchtower / build-image (push) Successful in 46s
Build, push image, and notify Watchtower / notify (push) Successful in 12s

This commit is contained in:
2026-08-17 16:01:33 +02:00
parent 656afa6e2d
commit ffbb350520
2 changed files with 19 additions and 18 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ def send_alert_sms(to_phone: str, room_title: str, room_link: str = None, client
# --- BUILD SMS CONTENT --- # --- BUILD SMS CONTENT ---
body = ( body = (
f"Alert: A technical issue occurred with your equipment/microwave. " f"Alert: A technical issue occurred with your SmartWave equipment/microwave. "
f"A support chat room '{room_title}' has been created to assist you.\n\n" f"A support chat room '{room_title}' has been created to assist you.\n\n"
) )
+10 -9
View File
@@ -214,6 +214,8 @@ def alert():
room_title = f"Support - {client_name}" room_title = f"Support - {client_name}"
room_link = None room_link = None
webex_status = "skipped" webex_status = "skipped"
# --- TWILIO SMS LOGIC ---
sms_sent = False
three_minutes_ago = datetime.now(timezone.utc) - timedelta(minutes=3) three_minutes_ago = datetime.now(timezone.utc) - timedelta(minutes=3)
@@ -265,16 +267,8 @@ def alert():
current_app.logger.exception("Failed to create Webex support room") current_app.logger.exception("Failed to create Webex support room")
webex_status = f"creation_failed: {str(e)}" webex_status = f"creation_failed: {str(e)}"
# Update document with room details
if webex_room_id:
alert_collection.update_one(
{"_id": saved_alert.inserted_id},
{"$set": {"webex_room_id": webex_room_id, "webex_room_title": room_title, "webex_room_link": room_link}}
)
# --- SEND SMS --- # --- SEND SMS ---
sms_sent = False if webex_room_id and client_phone and not SAVEUP_TWILIO_API_TOKEN:
if client_phone and not SAVEUP_TWILIO_API_TOKEN:
sms_sent = send_alert_sms( sms_sent = send_alert_sms(
to_phone=client_phone, to_phone=client_phone,
room_title=room_title, room_title=room_title,
@@ -282,6 +276,13 @@ def alert():
client_email=client_email client_email=client_email
) )
# Update document with room and sms details
if webex_room_id:
alert_collection.update_one(
{"_id": saved_alert.inserted_id},
{"$set": {"webex_room_id": webex_room_id, "webex_room_title": room_title, "webex_room_link": room_link, "sms_sent": sms_sent}}
)
else: # Just save the sms
alert_collection.update_one( alert_collection.update_one(
{"_id": saved_alert.inserted_id}, {"_id": saved_alert.inserted_id},
{"$set": {"sms_sent": sms_sent}} {"$set": {"sms_sent": sms_sent}}