# SMS Configuration
SMS_ENABLED = os.environ.get("SMS_ENABLED", "False").lower() == "true"
SMS_PROVIDER = os.environ.get("SMS_PROVIDER", "simulation") # "twilio", "aws_sns", or "simulation"
# Twilio Configuration (if using Twilio)
TWILIO_ACCOUNT_SID = os.environ.get("TWILIO_ACCOUNT_SID", "")
TWILIO_AUTH_TOKEN = os.environ.get("TWILIO_AUTH_TOKEN", "")
TWILIO_PHONE_NUMBER = os.environ.get("TWILIO_PHONE_NUMBER", "")
# AWS SNS Configuration (if using AWS SNS)
AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID", "")
AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY", "")
AWS_REGION = os.environ.get("AWS_REGION", "us-east-1")- Sign up at: https://www.twilio.com/try-twilio
- Get your Account SID (starts with "AC...")
- Get your Auth Token
- Get a Twilio phone number
pip install twilioREPLACE THIS:
# SMS Configuration
SMS_ENABLED = os.environ.get("SMS_ENABLED", "False").lower() == "true"
SMS_PROVIDER = os.environ.get("SMS_PROVIDER", "simulation") # "twilio", "aws_sns", or "simulation"
# Twilio Configuration (if using Twilio)
TWILIO_ACCOUNT_SID = os.environ.get("TWILIO_ACCOUNT_SID", "")
TWILIO_AUTH_TOKEN = os.environ.get("TWILIO_AUTH_TOKEN", "")
TWILIO_PHONE_NUMBER = os.environ.get("TWILIO_PHONE_NUMBER", "")
# AWS SNS Configuration (if using AWS SNS)
AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID", "")
AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY", "")
AWS_REGION = os.environ.get("AWS_REGION", "us-east-1")WITH THIS:
# SMS Configuration
SMS_ENABLED = True # ← CHANGED: Enable SMS
SMS_PROVIDER = "twilio" # ← CHANGED: Use Twilio
# Twilio Configuration (if using Twilio)
TWILIO_ACCOUNT_SID = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # ← ADD YOUR SID HERE
TWILIO_AUTH_TOKEN = "your_auth_token_here" # ← ADD YOUR TOKEN HERE
TWILIO_PHONE_NUMBER = "+1234567890" # ← ADD YOUR TWILIO NUMBER HERE
# AWS SNS Configuration (if using AWS SNS)
AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID", "")
AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY", "")
AWS_REGION = os.environ.get("AWS_REGION", "us-east-1")python run.pyYou should see:
✅ Twilio SMS client initialized
- Book an appointment with YOUR phone number
- Check your phone for SMS!
This is better for production as credentials aren't in code.
Create a file named .env in your project root:
# .env file
SMS_ENABLED=true
SMS_PROVIDER=twilio
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_auth_token_here
TWILIO_PHONE_NUMBER=+1234567890pip install python-dotenvAdd this at the TOP of config.py (after imports):
"""
Application configuration.
"""
import os
from dotenv import load_dotenv # ← ADD THIS
load_dotenv() # ← ADD THIS
BASE_DIR = os.path.abspath(os.path.dirname(__file__))The existing config will now read from .env file:
# SMS Configuration
SMS_ENABLED = os.environ.get("SMS_ENABLED", "False").lower() == "true"
SMS_PROVIDER = os.environ.get("SMS_PROVIDER", "simulation")
# ... rest stays the samepython run.pyRun this command:
python test_sms_configuration.pyYou should see:
✅ Twilio is CONFIGURED - Real SMS will be sent!
- Start app:
python run.py - Look for:
✅ Twilio SMS client initialized - Book appointment with YOUR phone number
- Check console for:
✅ REAL SMS SENT via Twilio to +1234567890 - Check your phone!
Check these:
- ✅
SMS_ENABLED = True(not False) - ✅
SMS_PROVIDER = "twilio"(not "simulation") - ✅ All three Twilio credentials are filled in
- ✅ App was restarted after changes
- ✅ Twilio package is installed:
pip install twilio
pip install twilio- Double-check Account SID starts with "AC"
- Verify Auth Token is correct
- Check for extra spaces or quotes
- Twilio trial can only send to verified numbers
- Verify your phone in Twilio Console
- Or upgrade to paid account (no restrictions)
Current: Simulation mode (prints to console)
To Enable Real SMS:
- Get Twilio credentials (free trial)
- Change 3 lines in config.py:
SMS_ENABLED = TrueSMS_PROVIDER = "twilio"- Add your credentials
- Install:
pip install twilio - Restart app
- Test with your phone number
Time Required: 5 minutes
Cost: Free trial ($15 credit) or ~$1 per 100 SMS
Replace lines 48-59 in config.py with this (add your credentials):
# SMS Configuration
SMS_ENABLED = True
SMS_PROVIDER = "twilio"
# Twilio Configuration
TWILIO_ACCOUNT_SID = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # Your SID
TWILIO_AUTH_TOKEN = "your_auth_token_here" # Your token
TWILIO_PHONE_NUMBER = "+1234567890" # Your Twilio number
# AWS SNS Configuration (not used if using Twilio)
AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID", "")
AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY", "")
AWS_REGION = os.environ.get("AWS_REGION", "us-east-1")Then restart: python run.py
Done! 🎉