# Dispatch Spot v386 — Guarded Urgent Text Delivery Preparation

## Purpose

v386 continues the simple app-style notifications track after v385 added phone-number capture and explicit urgent-text opt-in.

The goal is to prepare urgent text delivery safely without turning on real SMS sending yet.

## Product Decision

Continue notifications before returning to CORI Mail.

Reason: text alerts should not move from opt-in directly to live sending. Dispatch Spot first needs a guarded preview step so users and admins can see what would be sent while provider details and live sending remain locked.

## What Changed

- Added a guarded urgent text preview API:
  - `/api/app-notifications/urgent-text-preview`
- Extended notification delivery logic so Dispatch Spot can prepare a short urgent text preview from current urgent alerts.
- Updated the Delivery Status panel on `/notifications` with a simple **Preview urgent text** action when text alerts are opted in.
- The preview shows:
  - whether urgent text preparation is ready
  - the destination phone number
  - the short urgent text body
  - a clear message that the text is not sent yet
- Kept Twilio setup in:
  - `/company/integrations`
  - Twilio tab
- Kept real SMS sending locked for a future build.

## What Is Still Guarded

v386 does not send real text messages.

Real urgent-text sending still needs:

- explicit user opt-in
- Twilio setup in Workspace Integrations
- final send guard
- delivery audit record
- provider error handling
- opt-out protection
- clear user-facing safety wording

## Page Placement

The normal Notifications page may show a simple urgent text preview.

It must not show:

- Twilio account SID
- Twilio auth token
- messaging service IDs
- webhook URLs
- provider logs
- delivery diagnostics

Those stay in Workspace Settings or future Super Admin support areas.

## Prisma Schema Impact

No Prisma schema changes were made in v386.

v386 uses the text opt-in fields added in v385.

## Build Rule Impact

`DISPATCH_SPOT_BUILD_RULES.md` now includes the Guarded Urgent Text Delivery Prep Rule.
