sms Operation
Send SMS and MMS messages via Twilio, Vonage, or AWS SNS with template rendering, batch processing, and E.164 validation. Thesms operation handles text messaging for OTP codes, alerts, notifications, and two-factor authentication with 98% open rates and instant delivery.
Basic Usage
Configuration
SMS Providers
Twilio (Recommended)
Industry-leading SMS provider with 99.95% uptime and global coverage:- Sign up at twilio.com
- Get Account SID and Auth Token from console
- Purchase a phone number or create Messaging Service
- Set secrets:
- US/Canada: $0.0079/SMS
- UK: $0.04/SMS
- India: $0.0057/SMS
- Full pricing
- Standard: 100 SMS/second
- Messaging Service: 1,000 SMS/second
- Free trial: 1 SMS/second
Vonage (formerly Nexmo)
Cost-effective SMS with strong international coverage:- Sign up at vonage.com
- Get API Key and Secret
- Set secrets:
- US: $0.0057/SMS
- UK: $0.0331/SMS
- Lower than Twilio in many regions
AWS SNS
Integrate with AWS infrastructure:- Enable SNS in AWS Console
- Create IAM user with SNS permissions
- Set secrets:
Phone Number Format
All phone numbers MUST use E.164 format:- US:
+1234567890 - UK:
+442071234567 - France:
+33123456789 - Japan:
+81312345678 - India:
+919876543210
1234567890- Missing + prefix+1 (234) 567-8900- Contains formatting+1-234-567-8900- Contains dashes001-234-567-8900- Wrong prefix
Common Use Cases
OTP Verification
Two-Factor Authentication
System Alerts
Order Notifications
Appointment Reminders
Batch Sending
Send personalized SMS to multiple recipients:MMS (Multimedia Messages)
Send images and media with Twilio:- Images: JPG, PNG, GIF
- Video: MP4, 3GP
- Audio: MP3, WAV
- Documents: PDF
- Max size: 5 MB per file
- Max files: 10 per message
- US/Canada: 0.0079/SMS)
- International: Varies by country
Template Rendering
Use Liquid templates for dynamic content:Rate Limiting
Control sending rate to respect provider limits:- Twilio Free Trial: 1 SMS/sec
- Twilio Standard: 10 SMS/sec
- Twilio Messaging Service: 100 SMS/sec
- Vonage: 10 SMS/sec
- AWS SNS: 20 SMS/sec
Error Handling
Retry on Failure
Fallback Provider
Validate Phone Numbers
Handle Batch Errors
Testing
Test with TestConductor
Mock SMS Provider
Best Practices
1. Keep Messages ShortCommon Pitfalls
Pitfall: Wrong Phone Format
Pitfall: Too Long Messages
Pitfall: No Error Handling
Pitfall: Missing Opt-Out
SMS vs Email Comparison
| Feature | SMS | |
|---|---|---|
| Open Rate | 98% | 20% |
| Delivery Speed | Instant | Minutes to hours |
| Cost | 0.04/msg | 0.001/msg |
| Length | 160 chars (1 segment) | Unlimited |
| Media | MMS only (5 MB) | Full HTML, attachments |
| Best For | Alerts, OTP, urgent | Newsletters, receipts, long-form |
| Compliance | TCPA, GDPR | CAN-SPAM, GDPR |
Troubleshooting
SMS Not Delivering
- Verify phone format - Must be E.164 (+1234567890)
- Check provider credentials - Ensure Account SID/Auth Token correct
- Review rate limits - You may be hitting throttles
- Check provider console - View delivery reports
- Test with own number - Confirm basic functionality
Rate Limit Errors
Invalid Phone Number Errors
Message Too Long
- Single SMS: 160 chars (GSM-7) or 70 chars (Unicode)
- Concatenated SMS: Up to 1600 chars (10 segments)
- Cost: Each segment charged separately
- Solution: Shorten message or use link shorteners

