KODA Backend Developer Tasks
Complete Task Breakdown & Specifications
Table of Contents
- Overview
- Phase 1 Tasks
- Package 1.3: Authentication & Multi-Tenant Foundation
- Package 1.4: User Management APIs
- Package 1.5: Services & Catalog APIs
- Package 1.6: Booking & Reservations APIs
- Package 1.7: Payment Processing
- Package 1.8: POS APIs
- Package 1.9: Staff & HR APIs (Basic)
- Package 1.10: Notifications
- Package 1.11: Admin Panel APIs (Phase 1 - Essential)
- Package 1.12: Data Migration Scripts
- Phase 2 Tasks
- Phase 3 Tasks
- Summary
Overview
The Backend team is responsible for building the KODA Backend API (Laravel) and KODA AI engine. The backend serves all applications: KODA Mobile App, KODA Team, KODA Website, and KODA CORE.
Key Technologies
- PHP 8.2+
- Laravel 12
- MySQL (Multi-tenant architecture)
- Redis (Caching)
- RoadRunner/Octane (Performance)
- Google AI Studio (for KODA AI)
Important Notes
- Follow multi-tenant architecture principles
- All code must be PSR-12 compliant
- Comprehensive testing required (PHPUnit)
Phase 1 Tasks
Project Setup & Architecture Foundation
- Initialize new Laravel 12 project
- Configure multi-tenant database architecture
- Setup main database connection + dynamic sub-app connections
- Configure Redis for caching
- Setup Sanctum for API authentication
- Configure CORS
- Setup activity logging (Spatie)
- Configure environment files (.env.example)
- Setup Git repository structure
Multi-Tenant Core Architecture
- Create SubApplication model and migration (main DB)
- Create ApiKey model and migration with SHA-256 hashing
- Create SubApplicationDbCredential model (encrypted credentials)
- Implement ValidateApiKeyMiddleware with Redis caching
- Create ApiKeyCacheService (cache TTL: 1 hour, <2ms lookup)
- Implement RequestContextService (singleton for app_id, api_key_id)
- Create dynamic database connection manager
- Add app_id and api_key_id to activity logs
- Write comprehensive tests for multi-tenant isolation
User Registration with Deduplication
- Create users table migration (sub-app DB) with global_id
- Create users table in main DB (global registry)
- Create User model with multi-language name support
- Implement UserMatchingService (match by 4-part name + verified phone)
- Implement UserSyncService (sync verification between main & sub-app)
- Implement MultiTenantUserService for registration
- Create POST /api/v1/register endpoint with validation
- Handle deduplication logic (prevent duplicates across sub-apps)
- Auto-generate temporary password option (for staff registration)
- Comprehensive tests including multi-tenant scenarios
Phone Verification System (OTP)
- Create user_phones table migration (sub-app DB) with global_phone_id
- Create phone_verification_otps table migration (main DB)
- Create UserPhone model
- Create PhoneVerificationOtp model
- Implement OTPGenerationService (6-digit codes, 5-minute expiry)
- Implement OTPMessageService (format SMS messages)
- Implement OTPRateLimitService (prevent abuse)
- Implement OTPService (main orchestration)
- Create POST /api/v1/phone-verification/send-otp endpoint
- Create POST /api/v1/phone-verification/verify-otp endpoint
- Phone verification sync between main & sub-app DBs
- Tests for OTP generation, expiry, rate limiting
SMS Providers Integration
- Create sms_providers table (main DB)
- Create registered_sms_providers table (sub-app DB)
- Create sms_logs table (sub-app DB)
- Implement SMSProviderFactory
- Implement provider interfaces: Twilio, Vonage, MassJo, UmniahSMS, SMSMobileAPI
- Implement SMSService (send SMS with provider selection)
- Configuration management per sub-app
- Retry logic for failed SMS
- Comprehensive logging
- Tests for all providers (with mocking)
User Authentication (Login/Logout)
- Implement UserAuthenticationService
- Create POST /api/v1/login endpoint (phone + password)
- Sanctum token generation (multi-tenant aware)
- Activity logging for login attempts (success/failure)
- Create POST /api/v1/logout endpoint
- Token revocation
- Remember me functionality
- Failed login tracking (security)
- Tests for auth flows
Password Management
- Create password_reset_tokens table (main DB)
- Implement password reset flow with OTP
- Create POST /api/v1/password/forgot endpoint
- Create POST /api/v1/password/reset endpoint
- Create PUT /api/v1/password/change endpoint (authenticated)
- Password strength validation
- Activity logging for password changes
- Tests for password reset flows
Permissions System
- Create permissions table (main DB)
- Create permission_categories table (main DB)
- Create permission_category_permissions table (main DB)
- Create user_permission_categories table (main DB with app_id)
- Create permission_checks_log table (main DB with app_id)
- Create Permission model and relationships
- Implement PermissionService (check permissions)
- Create CheckPermission middleware
- Permission caching with Redis
- Cache invalidation on permission changes
- Tests for permission checks across sub-apps
Core Admin & Identity Verification
- Create core_admins table (main DB)
- Create user_identity_documents table (main DB)
- Create nationalities table (main DB)
- Create CoreAdmin model
- Create UserIdentityDocument model
- Implement identity verification endpoints (Core Admin only)
- POST /api/v1/core-admin/verify-identity/{userId}
- Identity verification sync (main → sub-app)
- Name fields become read-only after verification
- Tests for identity verification and restrictions
User Profile APIs
- Create GET /api/v1/profile endpoint (authenticated user)
- Create PUT /api/v1/profile/update endpoint
- Validate identity-verified restrictions (read-only name fields)
- Profile photo upload: POST /api/v1/profile/photo/upload
- Handle multi-language names (AR/EN)
- Activity logging for profile updates
- Tests for profile operations and restrictions
Phone Number Management APIs
- GET /api/v1/profile/phones (list user phones)
- POST /api/v1/profile/phones/add (add phone with OTP verification)
- DELETE /api/v1/profile/phones/{id} (remove phone, prevent if primary)
- PUT /api/v1/profile/phones/{id}/set-primary (set primary for calls/messages/WhatsApp)
- Maximum phones limit enforcement
- Automatic phone cleanup for unverified phones (scheduled command)
- Sync phone verification between main & sub-app
- Tests for phone management
Address Management APIs
- Create user_addresses table (sub-app DB)
- Create UserAddress model
- GET /api/v1/profile/addresses (list addresses)
- POST /api/v1/profile/addresses (add address)
- PUT /api/v1/profile/addresses/{id} (update address)
- DELETE /api/v1/profile/addresses/{id} (delete address)
- PUT /api/v1/profile/addresses/{id}/set-default
- Tests for address management
User Acquisition Source Tracking
- Create referral_sources table (sub-app DB)
- Create marketing_codes table (sub-app DB)
- Create user_acquisition_sources table (sub-app DB)
- Implement tracking on registration
- GET /api/v1/referral-sources (list for dropdowns)
- GET /api/v1/marketing-codes/validate/{code}
- Analytics endpoints for admin
- Tests for acquisition tracking
User Notes & Documents APIs
- Create user_notes table (sub-app DB)
- Create user_documents table (sub-app DB)
- GET /api/v1/users/{id}/notes (admin/staff only)
- POST /api/v1/users/{id}/notes (add note)
- PUT /api/v1/users/{id}/notes/{noteId} (edit note)
- DELETE /api/v1/users/{id}/notes/{noteId}
- POST /api/v1/users/{id}/documents/upload
- GET /api/v1/users/{id}/documents
- DELETE /api/v1/users/{id}/documents/{docId}
- File storage management (S3 or local)
- Tests for notes and documents
User Tags & Blacklist APIs
- Create tags table (sub-app DB)
- Create user_tags pivot table
- Create user_blacklist table (sub-app DB)
- GET /api/v1/tags (list available tags)
- POST /api/v1/users/{id}/tags/{tagId} (assign tag)
- DELETE /api/v1/users/{id}/tags/{tagId} (remove tag)
- POST /api/v1/users/{id}/blacklist (add to blacklist)
- DELETE /api/v1/users/{id}/blacklist (remove from blacklist)
- Tests for tags and blacklist
Service Categories & Departments
- Create service_departments table (sub-app DB)
- Create service_categories table (sub-app DB)
- Create Department model
- Create ServiceCategory model
- GET /api/v1/public/service-categories (public, cached)
- GET /api/v1/admin/service-categories (full details for admin)
- POST /api/v1/admin/service-categories (create)
- PUT /api/v1/admin/service-categories/{id} (update)
- DELETE /api/v1/admin/service-categories/{id}
- Multi-language support (AR/EN)
- Tests for categories management
Services CRUD & Configuration
- Create services table (sub-app DB) - comprehensive fields
- Create Service model with relationships
- GET /api/v1/public/services (public catalog)
- GET /api/v1/public/services/{id} (service detail)
- GET /api/v1/admin/services (admin list with filters)
- POST /api/v1/admin/services (create service)
- PUT /api/v1/admin/services/{id} (update)
- DELETE /api/v1/admin/services/{id}
- Multi-language descriptions
- Service images handling
- Activity logging for service changes
- Tests for service management
Price Groups & Dynamic Pricing
- Create price_groups table (sub-app DB)
- Create service_price_groups pivot table
- Implement dynamic pricing logic
- GET /api/v1/admin/price-groups
- POST /api/v1/admin/price-groups (create)
- PUT /api/v1/admin/price-groups/{id}
- POST /api/v1/admin/services/{id}/pricing (set prices per group)
- Calculate final price based on user's price group
- Tests for price calculations
Service Availability Management
- Create service_availability table
- Create branch_service_availability table
- Implement availability checking algorithm
- GET /api/v1/services/{id}/availability?date=X&branch=Y
- Consider: staff schedules, room availability, equipment availability
- Block unavailable time slots
- Buffer time between sessions
- Tests for availability logic
Branches & Locations APIs
- Create branches table (sub-app DB)
- Create Branch model
- GET /api/v1/public/branches (list for customers)
- GET /api/v1/branches/{id} (detail with hours, services, contact)
- GET /api/v1/admin/branches (full management)
- POST /api/v1/admin/branches (create)
- PUT /api/v1/admin/branches/{id} (update)
- DELETE /api/v1/admin/branches/{id}
- Working hours management
- Tests for branch management
Staff Assignment to Services
- Create staff_services pivot table
- Assign staff to services they can perform
- GET /api/v1/services/{id}/staff (available staff for service)
- POST /api/v1/admin/staff/{id}/services (assign services)
- DELETE /api/v1/admin/staff/{id}/services/{serviceId}
- Filter availability by staff skills
- Tests for staff-service relationships
Booking Availability Engine
- Implement complex availability checking algorithm
- Consider multiple factors: Staff availability (schedules, breaks, existing bookings)
- Room availability (capacity, equipment)
- Service duration
- Buffer time between sessions
- Branch working hours
- GET /api/v1/bookings/availability endpoint with query params
- Return available time slots for date range
- Color-code availability (green, orange, grey)
- Cache availability for performance
- Comprehensive tests for edge cases
Booking Creation & Management
- Create bookings table (sub-app DB)
- Create Booking model with relationships
- POST /api/v1/bookings/create endpoint
- Validate availability before booking
- Auto-assign staff/room if not specified
- Send confirmation SMS/email
- Create activity log entry
- Support "hold" (unpaid) vs "confirmed" (paid) bookings
- Tests for booking creation
Booking Update & Reschedule
- PUT /api/v1/bookings/{id}/reschedule endpoint
- Check new slot availability
- Apply rescheduling policy (fees, time limits)
- Update booking
- Send notification to customer
- Activity logging
- Staff notification (WebSocket placeholder)
- Tests for rescheduling rules
Booking Cancellation & Refunds
- DELETE /api/v1/bookings/{id}/cancel endpoint
- Apply cancellation policy (refund rules)
- Calculate refund amount
- Process refund (integrate with payment system)
- Update booking status
- Free up time slot
- Send notification
- Activity logging
- Tests for cancellation and refund scenarios
Golden Opportunities System
- Create golden_opportunities table
- Implement system to convert available slots to golden opportunities
- Manual conversion: POST /api/v1/admin/golden-opportunities/create
- Automatic conversion based on rules (scheduled job)
- GET /api/v1/golden-opportunities (list available, real-time)
- GET /api/v1/golden-opportunities/{id} (detail)
- POST /api/v1/golden-opportunities/{id}/book (requires immediate payment)
- Limit per day (scarcity)
- Expire opportunities automatically
- WebSocket publish on new/removed opportunities
- Activity logging
- Comprehensive tests
Check-in & Session Status Management
- PUT /api/v1/staff/bookings/{id}/check-in endpoint
- QR code validation: GET /api/v1/staff/bookings/verify-qr?code=X
- Status transitions: Pending → Checked-in → In Progress → Completed
- PUT /api/v1/staff/bookings/{id}/status (change status)
- Mark no-show
- Session timer tracking
- Activity logging for all status changes
- WebSocket notifications (placeholder)
- Tests for status workflows
Waiting List Management
- Create waiting_list table
- POST /api/v1/waiting-list (add customer to waiting list)
- GET /api/v1/waiting-list (list with filters)
- PUT /api/v1/waiting-list/{id}/notify (notify customer of availability)
- DELETE /api/v1/waiting-list/{id} (remove from list)
- Auto-expire waiting list entries
- Tests for waiting list operations
Booking History & Calendar APIs
- GET /api/v1/bookings/my-bookings endpoint (for customers)
- Filter by status: upcoming, completed, cancelled
- GET /api/v1/bookings/{id} (booking detail with QR code)
- GET /api/v1/admin/bookings/calendar (calendar view for staff)
- Filter by: date, branch, staff, room, service, status
- Support drag-and-drop rescheduling
- Booking statistics for dashboard
- Tests for calendar and history
Equipment & Room Management APIs
- Create equipment table
- Create rooms table
- Create service_equipment pivot (required equipment per service)
- GET /api/v1/admin/equipment
- POST /api/v1/admin/equipment (create)
- GET /api/v1/admin/rooms
- POST /api/v1/admin/rooms (create)
- Room availability for bookings
- Equipment availability for bookings
- Tests for equipment and room management
Summary
Total Hours by Phase
| Phase | Hours | Percentage |
|---|---|---|
| Phase 1 | 1,880 | 70% |
| Phase 2 | 240 | 9% |
| Phase 3 | 560 | 21% |
| TOTAL | 2,680 | 100% |
Total Tasks
- Phase 1: 102 tasks
- Phase 2: 20 tasks
- Phase 3: 28 tasks
- TOTAL: 150 tasks
Legacy Database Analysis & Mapping
- Analyze legacy database structure (55,000+ customer records)
- Document table schemas
- Map old structure to new structure
- Identify data inconsistencies
- Create data dictionary
- Plan migration strategy
- Deliverable: Migration mapping document
Customer Data Migration Script
- Create Artisan command: `php artisan migrate:customers`
- Read from legacy DB
- Transform data (name splitting, phone formatting, etc.)
- Insert into new structure:
- - Main DB: global user record
- - Sub-app DB: local user record with global_id
- Handle duplicates (merge logic)
- Progress tracking
- Error logging
- Tests with sample data
Phone Numbers Migration Script
- Create Artisan command: `php artisan migrate:phones`
- Migrate phone numbers to new structure
- Normalize phone numbers
- Set primary flags (calls, messages, WhatsApp)
- Link to migrated users (global_phone_id)
- Tests with sample data
Booking History Migration (If Needed)
- Analyze if booking history should be migrated
- If yes, create: `php artisan migrate:bookings`
- Transform old booking records
- Link to migrated customers
- Link to services (map old service IDs to new)
- Tests with sample data
Service & Package Data Migration
- Create: `php artisan migrate:services`
- Migrate service definitions
- Migrate pricing information
- Migrate package definitions
- Tests with sample data
Data Validation & Quality Check
- Create validation scripts
- Check data integrity:
- - All users have global_id
- - All phones have global_phone_id
- - Foreign keys valid
- - No orphaned records
- Generate validation report
- Fix identified issues
- Deliverable: Validation report
- Create loyalty_tiers table (main DB)
- Create loyalty_points_transactions table (sub-app DB)
- Create points_earning_rules table (main DB)
- Create points_redemption_options table (main DB)
- Create LoyaltyTier, PointsTransaction, EarningRule models
- Tests for relationships
- Implement PointsCalculationService
- Rules:
- - 1 point per 1 JOD spent on laser services
- - 2 points per 1 JOD spent on high-margin services (cross-sell)
- - Bonus points for completing packages
- - Bonus points for referrals
- - Bonus points for social sharing
- Automatic point crediting after payment
- Activity logging
- Tests for all earning scenarios
- GET /api/v1/loyalty/points/balance
- GET /api/v1/loyalty/points/history (earned/spent)
- Filter by date range
- Pagination
- Tests for points queries
- Define tier thresholds:
- - Insider: 0-749 points
- - Ambassador: 750-1999 points
- - Royal: 2000+ points
- GET /api/v1/loyalty/tiers (list all tiers)
- GET /api/v1/loyalty/tiers/my-progress
- Auto-upgrade users when reaching threshold
- Notification on tier upgrade
- Tier benefits management
- Tests for tier progression
- GET /api/v1/loyalty/redemption-options (what can be redeemed)
- POST /api/v1/loyalty/redeem endpoint
- Redemption types:
- - Discount on next booking
- - Free service
- - Passport benefit (Phase 2)
- Validate sufficient points
- Deduct points
- Create redemption record
- Activity logging
- Tests for redemption scenarios
- Points expiry policy: Expire if no activity for 6 months
- Scheduled job to expire points
- Warning notifications before expiry
- GET /api/v1/loyalty/points/expiring-soon
- Tests for expiration logic
- POST /api/v1/admin/customers/{id}/points/adjust (add/deduct points manually)
- Reason required
- Activity logging
- Tests for manual adjustments
Phase 2: Advanced Features
Loyalty, Passport, and Packages Systems
Loyalty Database Schema & Models
Points Calculation Engine
Points History & Balance APIs
Tier System & Progression
Points Redemption System
Points Expiration Management
Manual Points Adjustment (Admin)
Team Structure & Resource Allocation
Backend Team (From Official Budget & WBS)
Partner Management System
- Create partners table (main DB)
- Create partner_categories table (main DB)
- Create partner_benefits table (main DB)
- Create Partner, PartnerCategory models
- GET /api/v1/admin/partners
- POST /api/v1/admin/partners (create partner)
- PUT /api/v1/admin/partners/{id}
- DELETE /api/v1/admin/partners/{id}
- Partner contract management
- Tests for partner management
Partner Categories & Benefits
- Define partner categories (Dining, Fitness, Fashion, Entertainment)
- GET /api/v1/passport/partners (list for customers)
- GET /api/v1/passport/partners/category/{id}
- GET /api/v1/passport/partners/{id} (partner detail)
- Filter by location, category
- Cache partner list
- Tests for partner queries
Benefit Activation & QR Code System
- Create passport_benefit_activations table
- POST /api/v1/passport/partners/{id}/activate endpoint
- Generate time-limited QR code (5-minute expiry)
- QR code contains: user_id, partner_id, benefit_id, timestamp, signature
- POST /api/v1/passport/partners/verify-qr (partner validates QR)
- Mark benefit as used
- Limit: 1 use per month per partner (configurable)
- Activity logging
- Tests for QR generation and validation
Passport Usage Tracking & Analytics
- GET /api/v1/passport/my-activity (customer's usage history)
- GET /api/v1/admin/passport/analytics (admin dashboard)
- Partner-specific analytics
- Most popular partners
- Usage trends
- Tests for analytics queries
Partner PromoCode System
- Partners can have unique PromoCode for Golden Opportunities
- POST /api/v1/admin/partners/{id}/promo-code (assign code to partner)
- Partners can give this code to their VIP customers
- Usage tracking per partner's code
- Tests for partner promo codes
Packages Database Schema
- Create packages table (sub-app DB)
- Create package_services table (package includes multiple services)
- Create customer_packages table (purchased packages)
- Create customer_package_sessions table (session tracking)
- Create Package, CustomerPackage models
- Relationships setup
- Tests for relationships
Package Configuration APIs (Admin)
- GET /api/v1/admin/packages
- POST /api/v1/admin/packages (create package)
- PUT /api/v1/admin/packages/{id}
- DELETE /api/v1/admin/packages/{id}
- Package includes:
- - Name, description
- - Services (multiple)
- - Sessions per service
- - Total price
- - Validity period
- - Payment plans (full/installments)
- Tests for package management
Package Purchase & Payment Plans
- GET /api/v1/packages/available (list for customers)
- GET /api/v1/packages/{id} (package detail)
- POST /api/v1/packages/{id}/purchase
- Support payment plans:
- - Full payment upfront
- - Installments (3, 6, 12 months)
- Create customer_package record
- Payment processing
- Activity logging
- Tests for package purchase
Package Session Tracking & Usage
- GET /api/v1/packages/my-packages (customer's active packages)
- GET /api/v1/packages/{id}/details (sessions remaining, used, total)
- GET /api/v1/packages/{id}/usage-history
- Deduct session when booking with package
- POST /api/v1/bookings/create-with-package
- Prevent booking if no sessions remaining
- Tests for session tracking
Package Freezing System
- Create package_freezes table
- POST /api/v1/packages/{id}/freeze (freeze package, pause expiry)
- Freeze policy: Max 2 weeks per freeze, max 2 freezes per package
- DELETE /api/v1/packages/{id}/freeze/{freezeId} (end freeze)
- GET /api/v1/packages/{id}/freezes (freeze history)
- Adjust expiry date after unfreeze
- Tests for freezing logic
Package Transfer System
-
\n
- Create new Laravel application (KODA AI)
- Separate from KODA Backend (different codebase)
- Connect to KODA Backend database (read-only)
- Setup Google AI Studio SDK
- Environment configuration
- Basic API structure
- Tests setup
- Integrate Google AI Studio (Gemini) SDK
- Configure API keys
- Implement AI request service
- Rate limiting
- Error handling
- Retry logic
- Cost tracking
- Tests with AI SDK (mocked)
- Create knowledge_base_documents table
- Document upload system (PDF, DOCX, TXT)
- Text extraction from documents
- Vector embeddings generation (via Google AI)
- Vector storage (PostgreSQL with pgvector or separate vector DB)
- Semantic search functionality
- GET /api/v1/ai/knowledge-base/documents
- POST /api/v1/ai/knowledge-base/documents/upload
- DELETE /api/v1/ai/knowledge-base/documents/{id}
- Tests for knowledge base
- Implement RAG system
- Query → Vector search → Retrieve relevant documents → Include in AI prompt
- Improve AI accuracy with KODA-specific knowledge
- Context window management
- Tests for RAG
- POST /api/v1/ai/reports/generate endpoint
- Report types:
- 1. Monthly business summary
- 2. Customer behavior analysis
- 3. Service performance analysis
- 4. Revenue trends with insights
- 5. Predictive analytics (churn risk, etc.)
- Query KODA Backend database
- Analyze data with AI
- Generate narrative report (natural language)
- Export to PDF
- Chart generation (optional)
- Tests for report generation
- GET /api/v1/ai/dashboard/stats
- Conversation logs (count, types)
- Response accuracy metrics
- Handoff rate (AI → human)
- Customer satisfaction scores
- Cost tracking (API usage)
- GET /api/v1/ai/conversations (list conversations)
- GET /api/v1/ai/conversations/{id} (conversation detail)
- Tests for dashboard
- GET /api/v1/ai/settings
- PUT /api/v1/ai/settings
- Configurable settings:
- - AI model selection (Gemini models)
- - Temperature (creativity level)
- - Max tokens
- - Response tone (formal, friendly, etc.)
- - Language preference
- - Handoff triggers (when to escalate to human)
- Tests for settings management
- RESTful API to expose AI capabilities
- POST /api/v1/ai/chat (chat with AI)
- POST /api/v1/ai/analyze (analyze text/data)
- POST /api/v1/ai/recommend (get AI recommendations)
- Authentication (API key from main system)
- Rate limiting
- API documentation (OpenAPI)
- Tests for AI API
- POST /api/v1/admin/packages/{id}/transfer (transfer package to another customer)
- Validation: Both customers must exist, consent required
- Transfer all remaining sessions
- Update ownership
- Activity logging for both customers
- Tests for transfer
Phase 3: KODA AI Features
AI-Powered Intelligence, Social Media, Voice, and Real-Time Integration
KODA AI Application Setup
Google AI Studio Integration
AI Knowledge Base System
Retrieval-Augmented Generation (RAG)
AI Report Generation
AI Admin Dashboard
AI Settings & Configuration
AI API for Other KODA Apps
WhatsApp Business API Integration
- Integrate WhatsApp Business API (official or provider like Twilio)
- Webhook setup (receive messages)
- POST webhook endpoint: /api/v1/ai/whatsapp/webhook
- Message validation
- Message parsing
- Send message API
- Media handling (images, documents)
- Conversation threading
- Tests with WhatsApp API (mocked)
WhatsApp AI Responder
- Natural language understanding for WhatsApp messages
- Intent detection:
- - Booking inquiry
- - Service information request
- - Pricing question
- - General question
- - Complaint/issue
- Auto-response generation (using AI)
- Handoff logic (escalate to human if complex/urgent)
- Conversation state management
- Tests for intent detection and responses
Instagram API Integration
- Integrate Instagram API (Graph API)
- Webhook setup for DMs and comments
- POST /api/v1/ai/instagram/webhook
- Message parsing
- Send DM API
- Comment reply API
- Tests with Instagram API (mocked)
Instagram AI Responder
- Intent detection for Instagram messages/comments
- Auto-response generation
- Handoff logic
- Conversation management
- Tests for Instagram AI
Facebook Messenger Integration
- Integrate Facebook Messenger API
- Webhook setup
- POST /api/v1/ai/facebook/webhook
- Message parsing
- Send message API
- Tests with Facebook API (mocked)
Facebook AI Responder
- Intent detection for Facebook Messenger
- Auto-response generation
- Handoff logic
- Conversation management
- Page comments monitoring (optional)
- Tests for Facebook AI
Conversation Logs & Analytics
- Create conversations table (all channels)
- Store full conversation history
- GET /api/v1/ai/conversations (admin view)
- Analytics:
- - Response time
- - Resolution rate
- - Handoff rate
- - Customer satisfaction (if feedback collected)
- - Most common intents
- Tests for conversation logging
Lead Capture from Social Media
- Identify potential leads from conversations
- Extract contact information (phone, name)
- POST /api/v1/ai/leads/capture
- Store in KODA Backend CRM
- Assign to sales rep
- Notification to sales team
- Tests for lead capture
Handoff to Human Agent System
- Implement handoff triggers:
- - Customer explicitly requests human
- - AI confidence low
- - Complex/sensitive issue
- - VIP customer
- Notification to human agent (via KODA CORE)
- Conversation transfer
- Tests for handoff logic
Package Expiry & Notifications
- Scheduled job to check expiring packages
- Send notifications 30 days, 7 days, 1 day before expiry
- Auto-expire packages
- GET /api/v1/packages/expiring-soon
- Tests for expiry logic
| Team Member | Duration | Total Hours | Monthly Cost | Total Cost |
|---|---|---|---|---|
| Backend Lead (Senior) | 8.4 months | 1,608h (60% of 2,680h) | 2,200 JOD | 18,480 JOD |
| Backend Developer (Mid-level) | 8.4 months | 1,072h (40% of 2,680h) | 1,400 JOD | 11,760 JOD |
| Backend Team Total | 8.4 months | 2,680 hours | 3,600 JOD/mo | 30,240 JOD |
Note: These 150 backend tasks (2,680 hours) will be completed by the 2-person backend team working in parallel over 8.4 months.
Work Distribution by Phase
| Phase | Duration | Backend Lead | Backend Dev | Total Hours | Phase Cost |
|---|---|---|---|---|---|
| Phase 1 | 4 months | 1,128h | 752h | 1,880h | 14,400 JOD |
| Phase 2 | 2 months | 144h | 96h | 240h | 7,200 JOD |
| Phase 3 | 2.4 months | 336h | 224h | 560h | 8,640 JOD |
| TOTAL | 8.4 months | 1,608h | 1,072h | 2,680h | 30,240 JOD |
Task Assignment Strategy
Recommended Task Distribution
Backend Lead (Senior - 60% workload):
- Multi-tenant architecture & core setup
- Complex authentication systems
- Payment gateway integrations
- Booking availability engine
- KODA AI engine development
- Code reviews & architecture decisions
Backend Developer (Mid-level - 40% workload):
- User management APIs
- Services catalog APIs
- Notifications system
- Staff & HR basic APIs
- Data migration scripts
- Testing & documentation
Critical Path Tasks
Critical Dependencies
The following tasks must be completed in sequence (cannot be parallelized):
- BE-M3-001 → BE-M3-002 → BE-M3-003 (Foundation - blocks ALL subsequent backend work)
- BE-M6-008 (Availability Engine - blocks booking features)
- BE-M6-016 (Payment Gateway - blocks payment features)
- BE-M11-001 → BE-M11-002 (Data Migration - blocks production launch)
Parallelization Strategy: Once foundation tasks complete, both developers work on different modules simultaneously to achieve 8.4-month timeline instead of 16+ months sequential.