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
+18 -17
View File
@@ -214,6 +214,8 @@ def alert():
room_title = f"Support - {client_name}"
room_link = None
webex_status = "skipped"
# --- TWILIO SMS LOGIC ---
sms_sent = False
three_minutes_ago = datetime.now(timezone.utc) - timedelta(minutes=3)
@@ -260,32 +262,31 @@ def alert():
room_link = f"https://web.webex.com/spaces/{webex_room_id}"
webex_status = "created_new_room"
except Exception as e:
current_app.logger.exception("Failed to create Webex support room")
webex_status = f"creation_failed: {str(e)}"
# --- SEND SMS ---
if webex_room_id and client_phone and not SAVEUP_TWILIO_API_TOKEN:
sms_sent = send_alert_sms(
to_phone=client_phone,
room_title=room_title,
room_link=room_link,
client_email=client_email
)
# Update document with room details
# 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}}
{"$set": {"webex_room_id": webex_room_id, "webex_room_title": room_title, "webex_room_link": room_link, "sms_sent": sms_sent}}
)
# --- SEND SMS ---
sms_sent = False
if client_phone and not SAVEUP_TWILIO_API_TOKEN:
sms_sent = send_alert_sms(
to_phone=client_phone,
room_title=room_title,
room_link=room_link,
client_email=client_email
else: # Just save the sms
alert_collection.update_one(
{"_id": saved_alert.inserted_id},
{"$set": {"sms_sent": sms_sent}}
)
alert_collection.update_one(
{"_id": saved_alert.inserted_id},
{"$set": {"sms_sent": sms_sent}}
)
return jsonify({
"status": "success",