Overview
The conversation management system provides a comprehensive dashboard for viewing all WhatsApp interactions, monitoring bot performance, and handling human escalations. Track conversation history, confidence scores, and user engagement in real-time.Conversation Service
Core service for managing conversation data:Create or Retrieve Conversation
src/Services/ConversationService.php
Add Message
src/Services/ConversationService.php
Get Conversation History
src/Services/ConversationService.php
List All Conversations
src/Services/ConversationService.php
Get Statistics
src/Services/ConversationService.php
Conversation Statuses
- Active
- Pending Human
- Resolved
Normal conversations with AI enabled:
- Bot responds automatically
- RAG and OpenAI processing active
- Default state for new conversations
Dashboard Interface
The conversation dashboard provides a WhatsApp-style interface:Layout Structure
views/conversations.php
Mobile Responsive
views/conversations.php
Human Handoff
Users can request human assistance at any time:Trigger Keywords
webhook.php
Handoff Process
Human responds via dashboard
Agent views conversation in “Pendientes” tab and replies through the interface
Message Types
The system tracks different message types:Text Messages
Standard text responses from users and bot
Audio Messages
Voice messages with Whisper transcription
System Messages
Status updates and notifications
Human Replies
Messages sent by agents from dashboard
Message Metadata
Conversation Tracking
Webhook updates conversation state with each message:webhook.php
Deduplication
Prevents duplicate processing of webhook events:webhook.php
Performance Metrics
Track conversation and message statistics:Summary Statistics
Message Analysis
- Confidence scores: Track RAG performance per message
- Response time: Monitor bot latency
- Human handoff rate: Percentage requiring escalation
- Resolution time: Time from first message to closure
Best Practices
Regular Monitoring
Check pending_human conversations daily
Quick Responses
Respond to escalations within business hours
Confidence Tracking
Monitor low-confidence responses to improve RAG
Context Review
Examine context_used to validate document relevance
Database Schema
Next Steps
Dashboard Access
Access the conversation dashboard
WhatsApp Setup
Configure WhatsApp webhook