--- id: TASK-141 title: SMS/text-based poll input for rSpace (magic links + optional Twilio 2-way) status: To Do assignee: [] created_date: '2026-04-09 16:42' labels: - rChoices - rCal - integration - SMS dependencies: [] references: - modules/rchoices/mod.ts - modules/rcal/mod.ts - modules/rminders/mod.ts - server/index.ts (webhook pattern examples around line 2808) priority: high --- ## Description Enable lightweight poll/RSVP responses via text message. Users send a text or click a magic link in SMS/email to respond to polls (e.g. "1" for Yes, "0" for No). ## Phased approach: 1. **Phase 1 — Magic links (minimal infra):** Generate per-participant short token URLs for polls/RSVPs. Send via Mailcow email (free) or any SMS API. Recipient clicks link → minimal no-auth 1-tap response page → updates Automerge doc (rChoices poll or rCal RSVP). 2. **Phase 2 — Twilio 2-way SMS:** Twilio number (~$1/mo), outbound SMS with poll question + response codes, inbound webhook at `POST /api/sms/inbound` parses reply digit, phone→DID mapping table to attribute responses. ## Key integration points: - **rChoices** (`modules/rchoices/`) — simple polls (vote/rank/spider) - **rCal** (`modules/rcal/`) — event RSVPs (attendee fields exist but stub) - **rMinders** (`modules/rminders/`) — could add SMS as action type for scheduled sends - **Existing webhook pattern** — follow payment webhook style (unauthenticated POST endpoints) ## Design notes from initial discussion: - Magic link approach gets 90% of value with minimal new infra - Twilio costs ~$0.02/round-trip, magic links ~$0.01 outbound only - Email-based variant is free via existing Mailcow setup - Need phone→DID mapping if doing 2-way SMS ## Acceptance Criteria - [ ] #1 Magic link generation for polls/RSVPs with unique per-participant tokens - [ ] #2 Minimal no-auth response page (1-tap Yes/No) that updates Automerge doc - [ ] #3 Email delivery of magic links via Mailcow - [ ] #4 Optional: Twilio outbound SMS delivery - [ ] #5 Optional: Twilio inbound webhook parsing for 2-way SMS replies - [ ] #6 Optional: Phone-to-DID mapping table for SMS identity attribution