Skip to content

dudihisine/BestAppointmentManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– WhatsApp AI Appointment Manager

A complete, production-ready appointment management system with AI-powered optimization, WhatsApp integration, and automated background jobs.

✨ Features

πŸ“± WhatsApp-First Interface

  • Natural language processing - Understands "book haircut", "show appointments", etc.
  • Smart session management - Handles interrupted conversations gracefully
  • Professional message templates - Consistent, branded communication
  • Multi-step booking flows - Service selection, time preferences, confirmation

🎯 Appointment Management

  • Complete booking system - Service selection, time slots, confirmation
  • Reschedule functionality - Change existing appointments
  • Cancellation system - Cancel with gap-fill optimization
  • Appointment viewing - Client can see all their bookings

πŸ€– AI-Powered Optimization

  • Intent-based scheduling - Max Profit, Balanced, Free Time modes
  • Gap-fill automation - Automatically fills cancelled slots
  • Waitlist management - Priority-based notifications
  • Smart suggestions - Mode-specific optimization recommendations

⏰ Background Jobs & Automation

  • Appointment reminders - 24h, 2h, 30min before
  • Waitlist notifications - Instant alerts when slots open
  • Daily reports - Owner performance summaries
  • Redis Queue integration - Scalable background processing

🌐 Web Interface

  • Owner dashboard - Multi-date view, AI suggestions, waitlist management
  • Client booking interface - Easy online booking
  • WhatsApp test interface - Local testing without Twilio limits
  • Message capture system - See actual bot responses

πŸš€ Quick Start

1. Clone and Setup

git clone <your-repo-url>
cd BestAppointmentManager
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt

2. Environment Configuration

# Copy the example environment file
cp env.example .env

# Edit .env with your actual values
nano .env

3. Database Setup

# Start PostgreSQL and Redis with Docker
docker-compose up -d

# Run database migrations
alembic upgrade head

# Add test data
python add_test_data.py

4. Start the System

# Terminal 1: Start the main application
python -m uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

# Terminal 2: Start the background worker
python worker.py

5. Access the Interfaces

πŸ§ͺ Testing

Run All Tests

python test_complete_system.py

Test Specific Features

# Test background jobs
python test_background_jobs.py

# Test natural language processing
python test_natural_language.py

# Test individual components
python -m pytest tests/

πŸ“Š System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   WhatsApp      β”‚    β”‚   Web Interface β”‚    β”‚   Background    β”‚
β”‚   Interface     β”‚    β”‚   (FastAPI)     β”‚    β”‚   Jobs (RQ)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚                      β”‚                      β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚      Business Logic       β”‚
                    β”‚  β€’ Scheduler              β”‚
                    β”‚  β€’ Optimizer              β”‚
                    β”‚  β€’ Waitlist Manager       β”‚
                    β”‚  β€’ Policy Enforcer        β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚      Data Layer           β”‚
                    β”‚  β€’ PostgreSQL             β”‚
                    β”‚  β€’ Redis (Sessions)       β”‚
                    β”‚  β€’ SQLAlchemy ORM         β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ Configuration

Environment Variables

  • DATABASE_URL - PostgreSQL connection string
  • REDIS_URL - Redis connection string
  • TWILIO_ACCOUNT_SID - Twilio account SID
  • TWILIO_AUTH_TOKEN - Twilio auth token
  • TWILIO_WHATSAPP_FROM - WhatsApp sender number
  • TIMEZONE_DEFAULT - Default timezone
  • DEBUG - Debug mode (True/False)

Business Settings

  • Intent Modes: Max Profit, Balanced, Free Time
  • Service Configuration: Duration, price, buffer time
  • Business Hours: Start/end times, quiet hours
  • Policies: Cancellation, rescheduling rules

πŸ“± WhatsApp Integration

Test Mode (Default)

  • Messages are captured and displayed in web interface
  • No actual WhatsApp messages sent
  • Perfect for development and testing

Production Mode

  • Configure Twilio credentials in .env
  • Real WhatsApp messages sent to clients
  • Webhook endpoint: /webhooks/whatsapp

🎯 Usage Examples

For Business Owners

  1. πŸ“Š View daily schedules with AI optimization suggestions
  2. πŸ“‹ Manage waitlists with priority-based notifications
  3. πŸ“ˆ Get daily reports with performance metrics
  4. βš™οΈ Change intent modes (Max Profit, Balanced, Free Time)
  5. πŸ”„ Handle cancellations with automatic gap-fill

For Clients

  1. πŸ“… Book appointments via natural language
  2. πŸ”„ Reschedule existing appointments
  3. ❌ Cancel appointments easily
  4. πŸ“‹ View all upcoming appointments
  5. πŸ“± Get reminders automatically

πŸš€ Production Deployment

Docker Deployment

# Build and run with Docker Compose
docker-compose -f docker-compose.prod.yml up -d

Manual Deployment

  1. Set up PostgreSQL and Redis servers
  2. Configure environment variables
  3. Run database migrations
  4. Start the application and worker processes
  5. Set up reverse proxy (nginx)
  6. Configure SSL certificates

πŸ“ˆ Monitoring & Logging

  • Application logs - Structured logging with different levels
  • Performance metrics - Response times, error rates
  • Background job monitoring - Queue status, job failures
  • Database monitoring - Connection pools, query performance

πŸ”’ Security

  • Environment variables - Sensitive data in .env files
  • Database security - Connection encryption, user permissions
  • API security - Input validation, rate limiting
  • Session management - Secure session storage in Redis

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

  • Documentation - Check this README and code comments
  • Issues - Create GitHub issues for bugs or feature requests
  • Testing - Run the test suite to verify functionality

πŸŽ‰ Acknowledgments

  • FastAPI - Modern web framework
  • PostgreSQL - Reliable database
  • Redis - Fast caching and job queue
  • Twilio - WhatsApp messaging API
  • SQLAlchemy - Python ORM

Built with ❀️ for service businesses who want to automate their appointment management.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages