SMS Templates
All SMS messages and OTP verification flows sent via Twilio.
All SMS Templates
Booking Confirmation SMS
After bookingMessage
Endpoint: POST /api/sms/booking
Rate Limit: Per phone via rateLimitGuard
Notes: Date line only included if tentativeDate is provided.
Quote Follow-Up SMS
Auto: 5min + 24hr after quoteMessage
Endpoint: POST /api/sms/followup
Rate Limit: Per phone via rateLimitGuard
Notes: Auto-triggered by QuoteFollowUp durable object in owner-api: first at 5 minutes after quote generated, then again at 24 hours. URL shortened by Twilio (ShortenUrls: true).
Booking Reminder SMS
Auto: 10min + 24hr after paymentMessage
Endpoint: POST /api/sms/booking-reminder
Rate Limit: Per phone via rateLimitGuard
Notes: Auto-triggered by BookingFollowUp durable object in owner-api: first at 10 minutes after payment with no booking, then again at 24 hours. URL shortened by Twilio.
Auto-Trigger Flow (owner-api Durable Objects)
The follow-up and reminder SMS are triggered automatically by Cloudflare Durable Objects in the owner-api project:
QuoteFollowUp After a quote is generated → waits 5 min → sends follow-up email + SMS → waits 24hr → resends if not paid.
BookingFollowUp After payment received → waits 10 min → sends booking reminder email + SMS → waits 24hr → resends if booking not completed.
Both durable objects call the owner-quotes SMS endpoints internally.
OTP Verification
Provider: Twilio Verify service sends 6-digit OTP codes via SMS.
Send Endpoint: POST /api/twilio/send-otp
Verify Endpoint: POST /api/twilio/verify-otp
Rate Limiting: 5 OTP requests per IP per 10 minutes, 5 per phone per 10 minutes.
Test Bypass: Hardcoded test phone numbers can use code 123456.
Test Phones: +61413678805, +61483916555, +61483982777, +61482088564, +61482093666, +61483917100, +61483936333
Phone Format: Australian numbers auto-converted: 0413 678 805 → +61413678805. Validates E.164 format.
Configuration
| Variable | Purpose |
|---|---|
TWILIO_ACCOUNT_SID | Account identifier |
TWILIO_AUTH_TOKEN | Authentication token |
VERIFY_SERVICE_SID | OTP verification service |
TWILIO_MESSAGING_SERVICE_SID | SMS messaging service |