v1.0 Dashboard Public Profile GitHub
✅ Complete (Core) Phase 14

Phase 14 — AI Operational Layer / Orchestration

Automation rules engine, visual workflow builder, intent routing, failover system, AI action logging, and a human escalation queue — making KaiVox a self-operating AI platform.

What It Does

Phase 14 adds an automation layer that reacts to events across the platform. When a missed call comes in, an automation rule can automatically send a follow-up SMS. When a call has negative sentiment, the owner gets notified. When a customer's lead stage changes, a WhatsApp message goes out. All configured visually without code.

Key Routes

URLDescription
GET /automationsAutomation rules list
GET /automations/createVisual workflow builder — step 1: choose trigger
POST /automationsSave new automation rule
GET /automations/{id}/editEdit automation rule
POST /automations/{id}/toggleEnable/disable rule
DELETE /automations/{id}Delete rule
GET /escalationsHuman escalation queue
POST /escalations/{id}/assignAssign escalation to a staff member
POST /escalations/{id}/resolveMark escalation as resolved
POST /escalations/{id}/dismissDismiss escalation

Key Files

TypePath
Serviceapp/Services/AutomationService.php — condition checker + action dispatcher
Serviceapp/Services/IntentRouter.php — keyword intent detection (9 intents)
Serviceapp/Services/FailoverService.php — OpenAI failover wrapper
Modelapp/Models/AutomationRule.php
Modelapp/Models/AutomationRun.php — execution log
Modelapp/Models/AiActionLog.php
Modelapp/Models/EscalationQueue.php
Controllerapp/Http/Controllers/AutomationController.php
Tableautomation_rules — trigger_type, conditions (JSON), actions (JSON), is_active
Tableautomation_runs — rule_id, trigger_data, actions_taken, ran_at
Tableai_action_logs — event_type, call_log_id, data (JSON), created_at
Tableescalation_queue — tenant_id, call_log_id, priority, status, assigned_to, resolved_at

Automation Triggers (10)

TriggerFired By
missed_callVobizService: call duration < 15 seconds
call_endedVobizService: hangup webhook received
call_negative_sentimentVobizService: sentiment analysis = negative
appointment_bookedAppointmentsController: appointment created
appointment_cancelledAppointmentsController: appointment cancelled
new_customerCustomersController: new customer created (first call)
lead_stage_changedCustomersController: pipeline stage updated
inbound_smsTwilioService: inbound SMS webhook received
inbound_whatsappTwilioService: inbound WhatsApp webhook received
low_walletBillingService: wallet falls below threshold

Automation Actions (6)

ActionWhat It Does
send_smsSends an SMS to the customer (or a custom number)
send_whatsappSends a WhatsApp message to the customer
notify_staffSends an internal notification to a staff member
move_leadMoves the customer to a specified pipeline stage
create_escalationCreates a record in the escalation queue
add_tagAdds a tag to the customer record (future — tag system)

Escalation Queue

When the AI detects an emergency or human escalation request during a call, or when an automation rule creates an escalation, a record is added to the escalation queue.

Priority Levels

  • emergency — caller mentioned emergency; shown at top in red
  • high — caller requested human; shown in orange
  • normal — complaint or negative sentiment; shown in yellow
  • low — routine escalation; shown in green

AI Action Log

Every significant AI event is recorded in ai_action_logs:

  • intent_detected — intent identified by IntentRouter
  • response_generated — OpenAI returned a response
  • escalation_triggered — emergency or human handoff created
  • failover_activated — OpenAI failed, fallback response used

What's Complete

  • Automation rules engine: full CRUD, 10 trigger types, conditional logic (AND), 6 action types
  • Visual workflow builder UI: trigger cards → condition builder → action builder → save
  • AutomationService: condition checker + action dispatcher + run logger
  • IntentRouter: 9-intent keyword detection before OpenAI call
  • FailoverService: wraps every OpenAI call, intent-aware fallback responses
  • AiActionLog: every intent/response/escalation/failover event logged
  • ConversationEngine updated: IntentRouter + FailoverService + AiActionLog wired in
  • Human escalation queue dashboard: priority levels, assign/resolve/dismiss workflow
  • VobizService wired: call_ended + missed_call + call_negative_sentiment triggers
  • AppointmentsController wired: appointment_booked + appointment_cancelled triggers
  • Automation + Escalation nav items in sidebar

What's Deferred

  • Multi-channel context sync (same context across call + SMS + WhatsApp)
  • Role-based AI permissions (different AI behaviour per caller segment)
  • Twilio hangup trigger wiring (same as Vobiz — needs TwilioService update)
  • Zapier-style event bus (pub/sub for external integrations)