✅ SMS system is READY but in simulation mode
✅ Messages print to console instead of sending to phones
✅ To enable real SMS, follow steps below (5 minutes)
- Go to: https://www.twilio.com/try-twilio
- Sign up for free account
- Verify your email and phone number
- You get $15 free credit (enough for ~2,000 SMS)
- Go to Twilio Console: https://console.twilio.com/
- Find your Account SID and Auth Token
- Get a Twilio phone number:
- Click "Get a Trial Number" or
- Go to Phone Numbers → Buy a Number
pip install twilioOption A: Environment Variables (Recommended for Production)
Create a .env file in your project root:
SMS_ENABLED=true
SMS_PROVIDER=twilio
TWILIO_ACCOUNT_SID=your_account_sid_here
TWILIO_AUTH_TOKEN=your_auth_token_here
TWILIO_PHONE_NUMBER=+1234567890Then install python-dotenv:
pip install python-dotenvAdd to config.py at the top:
from dotenv import load_dotenv
load_dotenv()Option B: Direct Configuration (Quick Testing)
Edit config.py and change these lines:
# SMS Configuration
SMS_ENABLED = True # Change from False to True
SMS_PROVIDER = "twilio" # Change from "simulation" to "twilio"
# Twilio Configuration
TWILIO_ACCOUNT_SID = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # Your SID
TWILIO_AUTH_TOKEN = "your_auth_token_here" # Your token
TWILIO_PHONE_NUMBER = "+1234567890" # Your Twilio numberpython run.pyYou should see:
✅ Twilio SMS client initialized
Book an appointment with YOUR phone number and you'll receive a real SMS!
pip install boto3- Go to AWS Console → IAM
- Create user with SNS permissions
- Get Access Key ID and Secret Access Key
Edit config.py:
SMS_ENABLED = True
SMS_PROVIDER = "aws_sns"
AWS_ACCESS_KEY_ID = "your_access_key"
AWS_SECRET_ACCESS_KEY = "your_secret_key"
AWS_REGION = "us-east-1"python run.pyWhen you start the app, you should see:
✅ Twilio SMS client initialized
or
✅ AWS SNS client initialized
If you see:
📱 SMS SIMULATION - TO: +91-9876543210
(SMS_ENABLED = False in config)
Then SMS is still in simulation mode.
- Start your app:
python run.py - Book an appointment at: http://localhost:5000/patient/book
- Use YOUR phone number
- Check your phone for SMS!
You should see in console:
✅ REAL SMS SENT via Twilio to +1234567890
Message SID: SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Status: queued
pip install twilio- Double-check your Account SID and Auth Token
- Make sure there are no extra spaces
- Verify in Twilio Console
- Twilio trial accounts can only send to verified numbers
- Verify your phone in Twilio Console
- Or upgrade to paid account (no trial restrictions)
Check console output:
- ✅ = SMS sent successfully
- ❌ = Error (check error message)
- 📱 SIMULATION = Still in simulation mode
- Check
config.py:SMS_ENABLED = True - Check
config.py:SMS_PROVIDER = "twilio" - Check credentials are set
- Restart the app
- Look for "✅ Twilio SMS client initialized" on startup
- Free Trial: $15 credit
- SMS Cost: ~$0.0075 per SMS (varies by country)
- India: ~₹0.50 per SMS
- USA: ~$0.0075 per SMS
- Monthly: ~$1 for 100 SMS
- First 100 SMS: Free (monthly)
- After 100: $0.00645 per SMS
- Very cost-effective for high volume
If you want to keep simulation mode for development but enable real SMS for production:
# config.py
import os
# Use environment variable to control SMS
SMS_ENABLED = os.environ.get("SMS_ENABLED", "False").lower() == "true"Then:
- Development: Don't set SMS_ENABLED → Simulation mode
- Production: Set
SMS_ENABLED=true→ Real SMS
SMS_ENABLED = False
SMS_PROVIDER = "simulation"SMS_ENABLED = True
SMS_PROVIDER = "twilio"
TWILIO_ACCOUNT_SID = "ACxxxx..."
TWILIO_AUTH_TOKEN = "your_token"
TWILIO_PHONE_NUMBER = "+1234567890"SMS_ENABLED = True
SMS_PROVIDER = "aws_sns"
AWS_ACCESS_KEY_ID = "your_key"
AWS_SECRET_ACCESS_KEY = "your_secret"
AWS_REGION = "us-east-1"✅ Current: Simulation mode (prints to console)
✅ To Enable: Set SMS_ENABLED = True and configure provider
✅ Providers: Twilio (easiest) or AWS SNS
✅ Cost: Free trial or ~$1 per 100 SMS
✅ Time: 5 minutes to set up
The SMS system is production-ready - just add your credentials!