Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Encore Health OS supports SMS delivery for critical notifications via Twilio API. SMS is ideal for time-sensitive alerts that require immediate attention.Configuration
Prerequisites
TWILIO_ACCOUNT_SIDsecret configuredTWILIO_AUTH_TOKENsecret configuredTWILIO_PHONE_NUMBERsecret configured- Verified phone number in user profile
SMS Provider
The platform uses Twilio for SMS delivery:- Global coverage (190+ countries)
- Two-way SMS support
- Delivery receipts
- Opt-out handling (STOP keyword)
Features
Phone Verification
Users must verify their phone number before receiving SMS:- Enter phone number (E.164 format)
- Receive 6-digit verification code
- Enter code to verify
- Enable SMS opt-in
Message Formatting
- Maximum 160 characters (single SMS segment)
- Automatic truncation with ”…” if longer
- Variable substitution supported
- Plain text only (no HTML)
Delivery Tracking
SMS messages track:- Sent - Delivered to Twilio
- Delivered - Confirmed received by carrier
- Failed - Delivery error
Usage
Phone Verification Component
SMS Preferences Component
Sending SMS Notifications
Phone Number Format
E.164 Format Required
SMS requires phone numbers in E.164 format:+prefix- Country code (1-3 digits)
- Subscriber number (up to 12 digits)
- US:
+12025551234 - UK:
+442071234567 - AU:
+61412345678
Validation
Phone numbers are validated on:- User profile update
- Verification request
- SMS send attempt
User Opt-In
Consent Requirements
SMS requires explicit user consent:- User verifies phone number
- User enables SMS opt-in toggle
- User selects notification types for SMS
Opt-Out Handling
Users can opt out by:- Replying “STOP” to any SMS
- Disabling SMS in notification preferences
- Removing phone number from profile
Best Practices
- Keep Messages Brief: 160 characters maximum
- Use for Critical Alerts Only: Reserve SMS for urgent matters
- Respect Time Zones: Avoid sending SMS at night
- Include Sender Name: Prefix with “Encore Health OS:”
- Provide Opt-Out: Include “Reply STOP to unsubscribe” occasionally
Rate Limits
Twilio rate limits:- Default: 1 message/second per phone number
- Burst: 30 messages/minute
- Daily: Custom limits per account
- 30 SMS/minute per organization
- Queue additional messages automatically
Character Limits
Single SMS (160 characters)
Plain text only, no special formatting.Multiple Segments
Messages > 160 characters split into multiple SMS:- Each segment: 153 characters
- Platform automatically truncates to 160
Special Characters
Some characters count double (GSM-7 encoding):[ ] { } | \ ^ ~ €
Testing
Development Testing
Use Twilio test credentials:- Create test project in Twilio
- Use test phone numbers
- Messages logged but not delivered
- No charges incurred
Production Testing
- Verify real phone number
- Send test SMS to your phone
- Confirm delivery receipt
- Test opt-out flow
Troubleshooting
SMS Not Sending
- Check Twilio credentials are configured
- Verify edge function deployed
- Confirm user has verified phone number
- Check user has SMS opt-in enabled
- Review edge function logs
Invalid Phone Number
- Verify E.164 format (starts with +)
- Check country code is correct
- Remove spaces, dashes, parentheses
- Use phone validation tool
Delivery Failures
Common reasons:- Phone number invalid or disconnected
- Carrier blocked message (spam filter)
- Country not supported
- Account balance insufficient
Verification Code Not Received
- Check phone number is correct
- Verify SMS carrier supports SMS
- Check spam folder (some carriers filter)
- Wait 2-3 minutes (carrier delays)
- Request new code
Cost Considerations
Twilio Pricing (approximate)
- US/Canada: $0.0079 per SMS
- UK: $0.04 per SMS
- Australia: $0.07 per SMS
- India: $0.004 per SMS
Cost Optimization
- Use SMS sparingly (critical alerts only)
- Batch notifications when possible
- Offer email alternative
- Monitor usage in Twilio dashboard
Security
PII Handling
- Phone numbers encrypted at rest
- Logs redact phone numbers (mask middle digits)
- Verification codes expire after 10 minutes
- No PHI in SMS messages
Opt-Out Compliance
Platform automatically:- Honors STOP keyword replies
- Updates user preferences
- Prevents future SMS to opted-out users
- Logs opt-out timestamp