28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
from twilio.rest import Client
|
|
import traceback
|
|
|
|
def test():
|
|
account_sid = "AC601e1962dc8417ddb3ae53cd8d865020"
|
|
auth_token = "08a68571a251d6d62f60dc83fc725b5a"
|
|
twilio_from = "whatsapp:+14155238886"
|
|
physician_number = "whatsapp:+918500176938"
|
|
|
|
msg_body = "🚨 *CURAFLOW CRITICAL ALERT* 🚨\n\n*Anomaly Detected:*\nTest Alert: Patient INR is 6.5, which is dangerously high while taking Warfarin.\n\n*Recommended Action:*\nImmediately administer Vitamin K and admit patient for observation."
|
|
|
|
print(f"!!! Triggering Real Twilio WhatsApp Alert to {physician_number} !!!")
|
|
|
|
try:
|
|
client = Client(account_sid, auth_token)
|
|
message = client.messages.create(
|
|
from_=twilio_from,
|
|
body=msg_body,
|
|
to=physician_number
|
|
)
|
|
print(f"WhatsApp message sent successfully! SID: {message.sid}")
|
|
except Exception as e:
|
|
print(f"Failed to send WhatsApp message: {str(e)}")
|
|
traceback.print_exc()
|
|
|
|
if __name__ == "__main__":
|
|
test()
|