🧠 HeyCMO
Workflows

Performance Snapshot

Capture a point-in-time KPI snapshot for trend tracking and learning insights.

Performance Snapshot Workflow

The Performance Snapshot Workflow captures a tenant's marketing KPIs at a point in time and persists them for trend analysis and the Self-Optimization loop.

When it runs

  • Inngest cron, fanned out per tenant
  • Default cadence: weekly
  • Also triggered ad hoc by the Analyst when investigating an anomaly

Inputs

FieldTypeDescription
period'day' | 'week' | 'month'Aggregation window
resourceIdstringTenant ID

What's captured

MetricSource
Published content countContentPiece table
Average eval scores (brand voice, quality, citability)Eval results
Engagement ratequery_post_analytics
Channel-level CTR / conversionsquery_ga4
Lead volumeEvent table (eventType='lead_logged')
Workflow durability metricsInngest run records

Steps

  1. Aggregate KPIs — Roll up the metrics above for the requested period.
  2. Compare against the prior snapshot — Compute deltas and flag significant changes.
  3. Persist — Write a performance_snapshot row keyed by customerId + capturedAt.
  4. Feed Self-Optimization — The snapshot is one of the inputs the Self-Optimization workflow uses to update routing weights and autonomy levels.

Querying snapshots

The Analyst uses the get_performance_trend tool to read snapshots over a date range; the get_learning_insights tool surfaces the most actionable deltas.

On this page