TaskFlow is an intelligent task management system that automatically detects, schedules, and manages tasks from Slack conversations using AI. It integrates with Google Calendar for smart scheduling and provides real-time updates through WebSocket connections.
- OpenAI Integration: Uses GPT-4o to analyze Slack messages for task content
- Smart Analysis: Extracts task title, description, urgency, importance, and deadlines
- Confidence Scoring: Provides confidence levels for task detection accuracy
- Context Awareness: Understands mentions, deadlines, and task semantics
- Google Calendar Integration: Automatically schedules tasks in available time slots
- Timezone Handling: Supports multiple timezones with proper conversion
- Conflict Resolution: Handles scheduling conflicts with user interaction
- Working Hours: Respects user-defined working hours and preferences
- Real-time Webhooks: Processes Slack messages as they arrive
- Multi-workspace Support: Handles multiple Slack workspaces per user
- Channel Preferences: Configurable channel monitoring settings
- Direct Messaging: Sends confirmations and notifications via Slack DM
- WebSocket Communication: Live updates for task status changes
- Connection Management: Handles multiple connections per user with limits
- Heartbeat Monitoring: Maintains connection health with ping/pong
- Auto-reconnection: Graceful handling of connection drops
client/src/
├── components/ # Reusable UI components
│ ├── ui/ # shadcn/ui components
│ ├── modals/ # Modal dialogs
│ └── *.tsx # Feature components
├── pages/ # Application pages
├── hooks/ # Custom React hooks
├── lib/ # Utility libraries
└── App.tsx # Main application router
server/
├── services/ # Core business logic
│ ├── slack.ts # Slack API integration
│ ├── google.ts # Google Calendar API
│ ├── openaiService.ts # AI task analysis
│ ├── scheduler.ts # Automatic task scheduling
│ └── websocket.ts # Real-time communication
├── routes.ts # API endpoints
├── storage.ts # Data access layer
└── index.ts # Server entry point
shared/schema.ts # Drizzle ORM schema definitions
├── users # User accounts and preferences
├── workspaces # Slack workspace configurations
├── tasks # Task records and status
└── working_hours # User availability settings
- Session Management:
server/routes.ts- Session-based authentication - Google OAuth:
server/services/google.ts- Calendar access tokens - Slack OAuth:
server/services/slackOAuth.ts- Workspace integration
- Task Detection:
server/services/openaiService.tsanalyzeMessageForTask()- AI-powered task analysis
- Task Creation:
server/services/taskCreation.tscreateTaskFromMessage()- Convert messages to tasks
- Task Scheduling:
server/services/scheduler.tsstartScheduler()- Background task processorscheduleUnscheduledTasks()- Find and schedule pending tasks
- Event Management:
server/services/calendarService.tscreateEvent()- Create calendar eventsupdateEvent()- Modify existing eventsgetCalendarEvents()- Fetch availability
- Timezone Handling:
server/utils/offsetUtils.tsconvertToUserTimezone()- Timezone conversionsformatDateWithOffset()- Date formatting
- Message Processing:
server/services/slackEvents.tshandleSlackEvent()- Process incoming webhooks
- Bot Communication:
server/services/slack.tssendMessage()- Send Slack messagessendTaskDetectionDM()- Task confirmation DMs
- Channel Management:
server/services/channelPreferences.ts- Channel monitoring configuration
- WebSocket Server:
server/services/websocket.tsbroadcastToUser()- Send updates to specific usershandleClientMessage()- Process client messages
- Node.js 18+ with npm
- PostgreSQL database
- API keys for external services
Create a .env file with the following variables:
# Database
DATABASE_URL=postgresql://username:password@localhost:5432/taskflow
# Slack Integration
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_SIGNING_SECRET=your-signing-secret
SLACK_CLIENT_ID=your-client-id
SLACK_CLIENT_SECRET=your-client-secret
# Google Calendar
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
# OpenAI
OPENAI_API_KEY=your-openai-api-key
# Security
SESSION_SECRET=your-secure-session-secret-min-32-chars
# Application
BASE_URL=http://localhost:5000
NODE_ENV=development-
Install Dependencies
npm install
-
Setup Database
npm run db:push
-
Start Development Server
npm run dev
-
Access Application
- Frontend: http://localhost:5000
- API: http://localhost:5000/api
GET /api/auth/me- Get current userPOST /api/auth/login- User loginPOST /api/auth/logout- User logoutGET /api/auth/google/login/url- Google OAuth URLGET /api/auth/google/login/callback- Google OAuth callbackGET /api/auth/slack/url- Slack OAuth URLGET /api/auth/slack/callback- Slack OAuth callback
GET /api/tasks- List user tasksGET /api/tasks/:id- Get specific taskPOST /api/tasks- Create new taskPUT /api/tasks/:id- Update taskDELETE /api/tasks/:id- Delete taskPOST /api/tasks/:id/complete- Mark task complete
GET /api/calendar/events- List calendar eventsPOST /api/calendar/events- Create calendar eventPUT /api/calendar/events/:id- Update calendar eventDELETE /api/calendar/events/:id- Delete calendar event
POST /api/slack/events- Slack event webhookPOST /api/slack/interactive- Slack interactive components
- Session-based authentication with httpOnly cookies
- 24-hour session expiration with automatic cleanup
- PBKDF2 password hashing with 10,000 iterations
- OAuth2 integration for Google and Slack
- Rate limiting: 100 requests per 15 minutes (general)
- Webhook rate limiting: 60 requests per minute
- HMAC-SHA256 signature verification for Slack webhooks
- Input validation using Zod schemas
- Secure error handling without information disclosure
- HSTS headers for HTTPS enforcement
- X-Frame-Options for clickjacking protection
- Content Security Policy headers
- Secure session configuration
- Message Received: Slack webhook delivers message
- AI Analysis: OpenAI analyzes message for task content
- User Confirmation: Bot sends confirmation DM to user
- Task Creation: User confirms, task saved to database
- Scheduling: Scheduler finds available time slot
- Calendar Event: Event created in Google Calendar
- Real-time Update: WebSocket notifies frontend
- Task Processing: Scheduler runs every 30 seconds
- User Filtering: Process users with Google Calendar integration
- Availability Check: Fetch calendar events for availability
- Slot Selection: Find optimal time based on:
- Working hours preferences
- Existing calendar events
- Task priority and deadline
- Estimated duration
- Event Creation: Create calendar event
- Status Update: Mark task as scheduled
/timezone-test- Test timezone handling/task-detection-test- Test AI task detection- Access these pages when logged in for debugging
- All services include comprehensive logging
- WebSocket connections are tracked and logged
- Scheduler operations are logged with timestamps
- Error handling includes detailed error messages
- Hot reload with Vite for frontend changes
- TypeScript compilation with tsx for backend
- Drizzle Studio for database inspection
- Built-in rate limiting bypass for development
npm run build- Node.js 18+ runtime
- PostgreSQL database
- All environment variables configured
- HTTPS endpoint for OAuth callbacks
- WebSocket connection limits (5 per user)
- Database connection pooling
- Rate limiting for API protection
- Session cleanup for memory management
- TypeScript strict mode enabled
- ESLint configuration for code quality
- Prettier for code formatting
- Type-safe database operations with Drizzle ORM
- Frontend: Use React Query for server state management
- Backend: Keep routes thin, business logic in services
- Database: Use Drizzle migrations, never manual SQL
- Testing: Add tests for new features and bug fixes
- Security: Validate all inputs with Zod schemas
- Shared Types: Define in
shared/schema.ts - UI Components: Use shadcn/ui components when possible
- Business Logic: Implement in
server/services/ - Database Operations: Use storage interface abstractions
-
Calendar Integration Not Working
- Verify Google OAuth credentials
- Check token expiration and refresh logic
- Ensure proper timezone configuration
-
Slack Webhooks Failing
- Verify webhook URL configuration
- Check signing secret for signature verification
- Ensure rate limiting isn't blocking requests
-
Task Detection Not Accurate
- Verify OpenAI API key is working
- Check message format and content
- Review AI prompt configuration
-
WebSocket Connection Issues
- Check connection limits (5 per user)
- Verify heartbeat/ping-pong mechanism
- Review client-side reconnection logic
- Check application logs for detailed error messages
- Use built-in test pages for debugging specific features
- Verify all environment variables are properly configured
- Ensure external API credentials are valid and have proper permissions
MIT License - see LICENSE file for details.