This guide shows you how to test the appointment system without needing actual WhatsApp/Twilio setup.
# Make sure containers are running
docker compose up -d
# Activate virtual environment
source venv/bin/activate
# Create test data (owner + services)
python setup_test_data.py
# Start the server
uvicorn app.main:app --reload# In a new terminal
python test_webhook.pyThis will simulate complete conversation flows for both owners and clients.
Owner Phone: +972501234567 (this is the test owner)
# Test owner setup
curl -X POST http://localhost:8000/webhooks/whatsapp \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "From=whatsapp:+972501234567&WaId=972501234567&Body=setup&MessageSid=test1"
# Test daily summary
curl -X POST http://localhost:8000/webhooks/whatsapp \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "From=whatsapp:+972501234567&WaId=972501234567&Body=summary&MessageSid=test2"
# Test help
curl -X POST http://localhost:8000/webhooks/whatsapp \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "From=whatsapp:+972501234567&WaId=972501234567&Body=help&MessageSid=test3"Client Phone: Any other number (e.g., +972509876543)
# Start booking
curl -X POST http://localhost:8000/webhooks/whatsapp \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "From=whatsapp:+972509876543&WaId=972509876543&Body=book&MessageSid=test4"
# Continue with name
curl -X POST http://localhost:8000/webhooks/whatsapp \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "From=whatsapp:+972509876543&WaId=972509876543&Body=John Doe&MessageSid=test5"
# Select service (1 = Haircut)
curl -X POST http://localhost:8000/webhooks/whatsapp \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "From=whatsapp:+972509876543&WaId=972509876543&Body=1&MessageSid=test6"Watch your FastAPI server terminal for:
- ✅ Message routing (owner vs client)
- ✅ Session state changes
- ✅ Database operations
- ✅ Response messages (these would be sent via WhatsApp)
# Check what's in the database
python setup_test_data.py show# Connect to Redis and check sessions
docker exec -it bestappointmentmanager-redis-1 redis-cli
> KEYS whatsapp_session:*
> GET whatsapp_session:+972509876543- First-time setup:
setup→ complete wizard - Daily routine:
summary→ see today's schedule - Settings change:
intent profit→ change optimization mode - Help system:
help→ see all commands
- New client booking:
book→ name → service → time - Returning client:
appointments→ see existing bookings - Session cancellation: Start booking →
cancel→ exit flow - Invalid inputs: Try wrong service numbers, invalid names
- Multi-step flows: Start booking, continue conversation
- Session expiry: Wait 30+ minutes, try to continue
- Context switching: Switch between different commands
- Error recovery: Send invalid inputs, recover gracefully
curl http://localhost:8000/health | python -m json.tool# Start server with more detailed logs
uvicorn app.main:app --reload --log-level debug
# Or filter logs
uvicorn app.main:app --reload | grep -E "(INFO|ERROR|WARNING)"# Connect to PostgreSQL
docker exec -it bestappointmentmanager-db-1 psql -U app -d scheduler
# Check tables
\dt
# Check owners
SELECT * FROM owners;
# Check sessions in Redis
docker exec -it bestappointmentmanager-redis-1 redis-cli KEYS "*""python-multipart not installed"
pip install python-multipart==0.0.6"Database connection failed"
docker compose up -d # Make sure containers are running"No owner found"
python setup_test_data.py # Create test data- "setup" → Timezone question
- "Asia/Jerusalem" → Work days question
- "1" → Work hours question
- "9:00-17:00" → Intent mode question
- "2" → Reminders question
- "24,2" → Lead time question
- "60" → Setup complete confirmation
- "book" → Name request
- "John Doe" → Service selection menu
- "1" → Time preference question
- "2" → Available slots (placeholder)
- "1" → Booking confirmation (placeholder)
The server runs with --reload, so you can:
- Make code changes
- Server automatically restarts
- Re-run tests immediately
- See changes in real-time
# Reset database (careful - deletes all data!)
docker compose down
docker compose up -d
alembic upgrade head
python setup_test_data.pyYour system is working correctly if:
- ✅ Health endpoint shows all services connected
- ✅ Owner messages route to owner flow
- ✅ Client messages route to client flow
- ✅ Sessions persist between messages
- ✅ Multi-step conversations work smoothly
- ✅ Error handling is graceful
- ✅ Database operations succeed
- ✅ Redis sessions are created/updated
Once basic testing works:
- Add real Twilio credentials to
.env - Use ngrok to expose localhost:
ngrok http 8000 - Set Twilio webhook to
https://your-ngrok-url.ngrok.io/webhooks/whatsapp - Test with real WhatsApp messages
The system is designed to work identically with real WhatsApp messages once Twilio is configured!