Removed logging
This commit is contained in:
@@ -1,9 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import logging
|
|
||||||
from twilio.rest import Client
|
from twilio.rest import Client
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
def send_alert_sms(to_phone: str, room_title: str, room_link: str = None, client_email: str = None) -> bool:
|
def send_alert_sms(to_phone: str, room_title: str, room_link: str = None, client_email: str = None) -> bool:
|
||||||
"""
|
"""
|
||||||
Sends an SMS alert using Twilio notifying the client of an issue and support room creation.
|
Sends an SMS alert using Twilio notifying the client of an issue and support room creation.
|
||||||
@@ -13,11 +10,11 @@ def send_alert_sms(to_phone: str, room_title: str, room_link: str = None, client
|
|||||||
from_phone = os.environ.get("TWILIO_PHONE_NUMBER") # Requires your Twilio sender phone number
|
from_phone = os.environ.get("TWILIO_PHONE_NUMBER") # Requires your Twilio sender phone number
|
||||||
|
|
||||||
if not account_sid or not auth_token or not from_phone:
|
if not account_sid or not auth_token or not from_phone:
|
||||||
logger.error("Twilio environment variables (TWILIO_SID, TWILIO_ACCOUNT_SECRET, TWILIO_PHONE_NUMBER) missing.")
|
print("Twilio environment variables (TWILIO_SID, TWILIO_ACCOUNT_SECRET, TWILIO_PHONE_NUMBER) missing.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not to_phone:
|
if not to_phone:
|
||||||
logger.warning("No recipient phone number provided for SMS.")
|
print("No recipient phone number provided for SMS.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# --- PRINT LINK/INFO BEFORE SENDING ---
|
# --- PRINT LINK/INFO BEFORE SENDING ---
|
||||||
@@ -51,8 +48,8 @@ def send_alert_sms(to_phone: str, room_title: str, room_link: str = None, client
|
|||||||
from_=from_phone,
|
from_=from_phone,
|
||||||
to=to_phone
|
to=to_phone
|
||||||
)
|
)
|
||||||
logger.info(f"SMS sent successfully to {to_phone}. Message SID: {message.sid}")
|
print(f"SMS sent successfully to {to_phone}. Message SID: {message.sid}")
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception(f"Failed to send SMS via Twilio to {to_phone}: {e}")
|
print(f"Failed to send SMS via Twilio to {to_phone}: {e}")
|
||||||
return False
|
return False
|
||||||
Reference in New Issue
Block a user