Skip to main content

Dashboard & Analytics

The Virsyn Voice AI dashboard system provides real-time and historical analytics across all call activity. Seven dedicated edge functions power KPI cards, trend charts, conversion funnels, campaign comparisons, call quality metrics, time-of-day heatmaps, and objection analysis.

Architecture

Raw Calls ──► process-enrichment-queue (AI analysis) ──► call_stats_daily (pre-aggregated)

┌──────────────────────────────────────────────┤
│ │ │ │
dashboard- dashboard- dashboard- dashboard-
overview timeseries funnel campaigns

┌──────────────────────────────────────────────┘
│ │ │
dashboard- dashboard- dashboard-
quality heatmap objections
(raw calls) (raw calls)
  • 5 endpoints query the pre-aggregated call_stats_daily table for fast lookups.
  • 2 endpoints (heatmap, objections) query the raw calls table for hour-level granularity and JSONB array unnesting.

Endpoints

FunctionData SourceDescription
dashboard-overviewcall_stats_dailySummary KPIs, disposition breakdown, quality metrics, tool usage
dashboard-timeseriescall_stats_dailyDaily aggregated metrics for trend charts
dashboard-funnelcall_stats_daily5-stage conversion funnel with step-to-step rates
dashboard-campaignscall_stats_daily + v_call_batch_summaryActive batch progress and campaign-level stats
dashboard-qualitycall_stats_dailyCall quality analytics with daily trends
dashboard-heatmapcallsBest-times-to-call day/hour distribution
dashboard-objectionscallsTop objections and buying signals analysis

Authentication

All endpoints require a Supabase JWT Bearer token. The backend resolves the user's agency_id automatically -- you never pass it as a parameter.

const response = await fetch(`${SUPABASE_URL}/functions/v1/<function-name>?params`, {
headers: {
'Authorization': `Bearer ${session.access_token}`,
'Content-Type': 'application/json',
},
});

Common Query Parameters

All endpoints share these filters:

ParameterTypeDefaultDescription
periodstring7dtoday, 7d, 30d, 90d, custom
start_datestring--ISO date YYYY-MM-DD (required when period=custom)
end_datestring--ISO date YYYY-MM-DD (required when period=custom)
campaign_idUUID--Filter to a specific campaign
client_idUUID--Filter to a specific client
note

The heatmap endpoint only supports 7d, 30d, 90d periods (no today or custom). The campaigns endpoint defaults to 30d instead of 7d.

Error Handling

All endpoints return errors in a consistent format:

{
"error": "Human-readable error message",
"details": "Technical detail (only in 500s)"
}
StatusMeaning
401Missing or invalid Bearer token
403User exists but has no agency_id
405Wrong HTTP method (must be GET)
500Server error (check details)

Data Freshness

SourceFreshness
call_stats_dailyUpdated by trigger when call analysis completes + cron every 6h for last 7 days
v_call_batch_summaryReal-time view (queries on read)
Raw calls tableReal-time (used by heatmap and objections endpoints)

Next Steps