Ir al contenido

Ver Métricas en Tiempo Real

Muestra KPIs actualizados automáticamente sin necesidad de recargar la página.

  1. Accede al Panel de Soporte
  2. El dashboard carga automáticamente con los datos del día
  3. Las métricas se actualizan cada 30 segundos
Detalles técnicos — Ver métricas en tiempo real

GET /api/support/dashboard

Parámetros:

  • periodtoday | week | month | custom
  • date_from — ISO 8601 (para rango personalizado)
  • date_to — ISO 8601
  • agent_id — UUID (opcional, filtra por agente)
  • team_id — UUID (opcional, filtra por equipo)
// Suscripción a cambios en tickets
const channel = supabase
.channel('dashboard-updates')
.on('postgres_changes', {
event: '*',
schema: 'public',
table: 'support_tickets',
}, (payload) => {
updateDashboardMetrics(payload);
})
.subscribe();
SELECT
COUNT(*) FILTER (WHERE status = 'open') AS open_tickets,
COUNT(*) FILTER (WHERE priority IN ('high','urgent') AND status = 'open') AS urgent_tickets,
COUNT(*) FILTER (WHERE sla_breach_at < now() + INTERVAL '1 hour' AND status = 'open') AS sla_at_risk,
AVG(EXTRACT(EPOCH FROM (first_response_at - created_at))/60)::INTEGER AS avg_response_minutes,
AVG(csat_score) AS avg_csat
FROM support_tickets
WHERE DATE(created_at) = CURRENT_DATE;