Skip to main content
A nudge is a proactive, dismissible prompt. Build one with NudgeData and show it with widget.showNudge(...). This example is from the playground:
function handleShowNudge() {
  widget.showNudge({
    type: 'deadline',
    message: 'Assignment deadline in 4 hours',
    explanation: 'You have not submitted the latest assignment yet.',
    confidence: 0.9,
    priority: 'high',
    dismissible: true,
    actionLabel: 'Open chat',
    action: () => widget.transitionTo('engage'),
  });
}

// later
widget.dismissNudge();
showNudge transitions the widget to the nudge state and fires both the nudgeShown event and the onNudgeShown hook. dismissNudge returns to idle when the widget is currently in the nudge state.

NudgeData

type NudgeType =
  | 'deadline'
  | 'missing-submission'
  | 'low-quiz-attempts'
  | 'pause-continuation'
  | 'advisor-eligibility';

interface NudgeData {
  type: NudgeType;
  message: string;
  explanation: string;
  confidence: number;                 // 0–1
  priority: 'low' | 'medium' | 'high';
  dismissible: boolean;
  expiresAt?: Date;
  actionLabel?: string;
  action?: () => void | Promise<void>;
}

Gate nudges globally

Optionally gate nudges through config.nudgeConfig:
interface NudgeConfig {
  enabled: boolean;
  minConfidence: number;                       // minimum confidence to show
  maxPerDay?: number;
  quietHours?: { start: number; end: number }; // hours to suppress nudges
}