Comprehensive documentation for the automated leave management system.
| Document | Description |
|---|---|
| Architecture | System components, data flow, tech stack |
| Slack Bot | Message handling, LLM parsing, confirmation flow |
| Database | Schema, models, relationships, migrations |
| Integrations | Google Calendar, Harvest, OpenAI setup |
| Web Admin | API endpoints, admin interface |
| Configuration | Environment variables, runtime settings |
| Deployment | Docker, local dev, production deployment |
| Technical Specification | Complete technical spec with edge cases |
The Leave Bot monitors the #wfh-leaves-ooo Slack channel for leave messages, uses an LLM to parse natural language into structured data, and upon user confirmation, syncs the leave to Google Calendar and Harvest.
- π€ Slack Integration - Socket Mode connection, real-time message processing
- π§ LLM Parsing - OpenAI-powered natural language understanding
- π Google Calendar - Automatic event creation with spanning support
- β±οΈ Harvest - Time entry logging for leave tracking
- β Confirmation Flow - Interactive buttons for user approval
- π₯οΈ Web Admin - FastAPI-based management interface
1. User posts: "On leave tomorrow"
β
2. Bot parses message with LLM
β
3. Bot replies with confirmation buttons
β
4. User clicks β Confirm
β
5. Background worker syncs to Calendar + Harvest
β
6. Bot updates message with success status
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β Slack ββββββΆβ Leave Bot ββββββΆβ PostgreSQL β
β Channel β β + Worker β β Database β
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β
ββββββββββββββΌβββββββββββββ
βΌ βΌ βΌ
ββββββββββββ ββββββββββββ ββββββββββββ
β OpenAI β β Google β β Harvest β
β API β β Calendar β β API β
ββββββββββββ ββββββββββββ ββββββββββββ
- Python 3.12+
- PostgreSQL 16+
- Slack workspace with bot configured
- OpenAI API key
- Google service account with Calendar API access
- Harvest Personal Access Token
# Install dependencies
uv sync
# Configure environment
cp .env.example .env
# Edit .env with your credentials
# Run migrations
uv run leave-bot migrate
# Start everything
uv run leave-bot allSee Deployment for detailed setup instructions.
leave-bot/
βββ leave_bot/
β βββ bot/ # Slack bot handlers
β βββ services/ # Calendar, Harvest, sync
β βββ web/ # FastAPI admin
β βββ models/ # SQLAlchemy models
βββ alembic/ # Database migrations
βββ scripts/ # Import utilities
βββ tests/ # Test suite
βββ doc/ # Documentation (you are here)
For issues or questions:
- Check the Technical Specification for edge cases
- Review the Configuration for setup issues
- Check health endpoints at
/api/healthfor integration status