Skip to content

Vapi motivational-interviewing voice call when a daily sit is missed #599

Description

@auerbachb

Background

Re-engagement today is text-only: miss-a-day push (#247) and the 8PM failure-reason reminder (#527). Product owner wants a stronger, human-feeling nudge: an outbound phone call via Vapi (voice-AI agent) that runs a motivational-interviewing conversation to help a lapsing user get back to meditating. Net-new — no prior issue or code (confirmed: no voice-agent / MI logic anywhere; only web-push exists).

Problem

Push notifications are easy to ignore, and there's no escalated intervention when someone stops practicing. There is no mechanism to place a call, run an MI conversation, or schedule such calls.

Proposed solution

  • Delivery — Vapi: a backend scheduler initiates an outbound call through the Vapi API; the MI assistant/script is configured on Vapi's side (Vapi supports this). We pass user context (name, current streak, days missed) into the assistant.
  • User-set schedule: the user sets a start time X and stop time Y. If no qualifying session is completed by X, place a call; repeat every hour from X until Y — or until a qualifying sit is completed that day, whichever comes first. Completing a sit cancels the remaining calls for the day.
  • Opt-in required: off by default; the user must explicitly opt in and provide a phone number; store consent (+ timestamp).
  • Trigger engine: reuse the existing "no sit yet today" / miss-a-day detection (Miss-a-day push notification with shortened-session follow-up #247/What happens if you miss a day recovery pattern? #238/iOS parity: 8PM failure-reason reminder + log-reason flow (port web PR #466) #527) and extend the notification cron (src/lib/notification-scheduler.ts + /api/cron/dispatch-notifications) to evaluate due calls hourly per user within [X, Y]; timezone handling per the iOS: daily practice reminders not delivering despite toggles enabled #561 fix.
  • Settings UI (iOS-first): a Notifications/Settings section to opt in, enter phone number, and set X and Y (mirroring the existing Reminder-time / Quiet-hours controls). Web parity later.
  • Cost/pricing: single-user (product owner) testing only for now — defer per-user caps/pricing.
  • Privacy/ToS: add call + consent disclosure to privacy/ToS docs later (follow-up, not MVP-blocking).

Acceptance Criteria

  • Opt-in setting (off by default) with phone-number capture + explicit consent recorded (with timestamp)
  • User sets start time X and stop time Y for the call window
  • With no qualifying session completed by X, a Vapi call is placed; it repeats hourly until Y or until a qualifying sit is completed that day
  • Completing any qualifying sit cancels the remaining calls for that day
  • The Vapi assistant runs an MI conversation and receives user context (streak / days-missed / name)
  • Call attempts + outcomes are logged; a Vapi/API failure does not crash the scheduler
  • No calls fire outside [X, Y] or when opted out
  • End-to-end works for the single test user (product owner)

Test Plan

  • Opt in, set X/Y, don't sit → receive a call at X, another an hour later, stopping at Y
  • Complete a sit before X → no call; complete after the first call → remaining calls cancelled
  • Opt out → no calls placed
  • Backend unit tests: hourly due-call evaluation within [X,Y], cancel-on-completion, opt-in gating, timezone
  • Vapi call initiation + context payload verified (mock the Vapi API)

Notes / Open questions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions