SMS opt-out via STOP persisted and respected for all future messages
Why it matters
TCPA (47 U.S.C. § 227) imposes statutory damages of $500–$1,500 per message sent to a consumer who has opted out via STOP. GDPR Article 21 and CCPA § 1798.120 impose parallel opt-out obligations in their jurisdictions. An in-memory opt-out store survives only until the process restarts; a persistent database table that is never read before sends is functionally equivalent to no opt-out at all. The failure mode is silent: every SMS send succeeds from the carrier's perspective while each one adds to legal exposure. A single batch run against a list that includes opted-out numbers can generate thousands of violations before anyone notices.
Severity rationale
Critical because sending SMS to opted-out numbers after a STOP violates TCPA and exposes the business to $500–$1,500 per-message statutory damages with no cap.
Remediation
Persist opt-out status in a dedicated database table and route every SMS send through a single function that checks it before calling the carrier API. Add a webhook handler at src/app/api/webhooks/sms/route.ts that writes STOP replies to the table immediately:
// prisma/schema.prisma
model SmsOptOut {
phone_number String @id
opted_out_at DateTime
opted_in_at DateTime?
}
// src/lib/sms.ts — central send function
async function sendSMS(phoneNumber: string, message: string) {
const optOut = await db.smsOptOut.findUnique({ where: { phone_number: phoneNumber } })
if (optOut?.opted_out_at && !optOut.opted_in_at) return { blocked: true }
return twilioClient.messages.create({ body: message, from: process.env.TWILIO_PHONE!, to: phoneNumber })
}
Every SMS-sending function in the codebase must call sendSMS() — not the Twilio client directly.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Booking Notifications & Reminders Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- external · TCPA-47-USC-227 — Telephone Consumer Protection Act — 47 U.S.C. § 227 (SMS opt-out requirements)
- gdpr · Art. 21 — Right to object (withdrawal of consent for direct marketing communications)
- ccpa · §1798.120 — Right to opt-out of sale / sharing of personal information
Taxons
History
- 2026-04-18·v1.0.0·Initial import from booking-notifications-reminders·automated