๐ฌ Direct Messages
Internal staff-to-staff direct messaging within the workspace. Slack-like 1:1 + group threads with HIPAA-grade audit logging.
๐ฌ What It Does
- 1:1 DMs between staff members in the same workspace.
- Group threads for ad-hoc conversations.
- PHI-aware โ messages can reference patients via
@patientmentions, automatically writing audit rows for cross-staff PHI access. - Searchable โ full-text search across the workspaceโs DM history (admin-permission required for cross-user search).

๐๏ธ Architecture
GET /api/v1/direct-messages List threads visible to user
POST /api/v1/direct-messages Send a new message (creates or appends to thread)
GET /api/v1/direct-messages/:threadId Read thread history + send in thread
PATCH /api/v1/direct-messages/:threadId Mark read (write receipt)| Layer | Tech |
|---|---|
| Storage | Postgres direct_messages + dm_threads with RLS (workspace + participant predicates) |
| Realtime | Supabase Realtime channels per thread |
| Audit | withAudit({ module: 'direct-messages' }) on every send |
| PHI mentions | Trigger function writes phi_access_log row when @patient:<id> syntax detected |
๐ณ Plans
Available on Standard+ as part of the unified chat experience. Free tier: receive only.