feat(GRO-106): STOP/HELP compliance + consent log #396

Closed
groombook-engineer[bot] wants to merge 1 commits from feat/GRO-106-stop-help into dev
groombook-engineer[bot] commented 2026-05-14 04:59:21 +00:00 (Migrated from github.com)

Summary

  • Add detectKeyword() — trims + uppercases message body and classifies as opt_in, opt_out, or help based on carrier-mandated keywords
  • Add handleConsentKeyword() — logs messageConsentEvents, updates clients.smsOptIn/smsOptOutDate/smsConsentDate with idempotency
  • Wire keyword detection into handleMessageReceived() so inbound STOP/START/HELP auto-reply and update consent state
  • 25-unit test suite covering all keywords, case insensitivity, whitespace tolerance, idempotency, and help state preservation

Test plan

  • npx vitest run apps/api/src/services/messaging/__tests__/consent.test.ts — 25/25 pass
  • Inbound STOP → clients.smsOptIn=false, consent event logged, auto-reply sent
  • Inbound START after opt-out → smsOptIn=true, consent event, confirmation reply
  • Existing sendMessage() still returns { suppressed: true } when smsOptIn=false (no regression)
  • HELP does not change opt-in state

🤖 Generated with Claude Code

## Summary - Add `detectKeyword()` — trims + uppercases message body and classifies as `opt_in`, `opt_out`, or `help` based on carrier-mandated keywords - Add `handleConsentKeyword()` — logs `messageConsentEvents`, updates `clients.smsOptIn`/`smsOptOutDate`/`smsConsentDate` with idempotency - Wire keyword detection into `handleMessageReceived()` so inbound STOP/START/HELP auto-reply and update consent state - 25-unit test suite covering all keywords, case insensitivity, whitespace tolerance, idempotency, and help state preservation ## Test plan - [x] `npx vitest run apps/api/src/services/messaging/__tests__/consent.test.ts` — 25/25 pass - [x] Inbound STOP → `clients.smsOptIn=false`, consent event logged, auto-reply sent - [x] Inbound START after opt-out → `smsOptIn=true`, consent event, confirmation reply - [x] Existing `sendMessage()` still returns `{ suppressed: true }` when `smsOptIn=false` (no regression) - [x] HELP does not change opt-in state 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Owner

Closing as superseded by PR #410 (feat/GRO-106-stop-help-v2), which is the updated version of this STOP/HELP compliance work with a full 25-unit test suite. Closing per org-wide PR backlog cleanup (GRO-1355).

Closing as superseded by PR #410 (feat/GRO-106-stop-help-v2), which is the updated version of this STOP/HELP compliance work with a full 25-unit test suite. Closing per org-wide PR backlog cleanup ([GRO-1355](/GRO/issues/GRO-1355)).
Scrubs McBarkley closed this pull request 2026-05-20 12:10:25 +00:00
This repo is archived. You cannot comment on pull requests.