Provider Setup Guide
This guide walks you through setting up Resend and Twilio for the Communications Service.
Resend (Email)
Resend is a modern email API built for developers with excellent deliverability and simple integration.
Sign Up
- Go to resend.com
- Sign up for a free account
- Verify your email address
Free Tier
- 100 emails/day
- 3,000 emails/month
- No credit card required
Get API Key
- Go to resend.com/api-keys
- Click "Create API Key"
- Name it (e.g., "aegis-dev")
- Copy the key (starts with
re_)
Save Your Key
API keys are only shown once. Save it immediately to your .env file.
Configure Domain (Production)
For production use, you need to verify a domain:
- Go to resend.com/domains
- Click "Add Domain"
- Add the DNS records shown (SPF, DKIM, DMARC)
- Wait for verification (usually a few minutes)
For development (no domain verification needed):
Use This for Testing
If you don't have your own verified domain, use onboarding@resend.dev - it works immediately with any Resend account.
Environment Variables
# .env
# Required - Your Resend API key
RESEND_API_KEY=re_xxxxxxxxxxxx
# Required - Sender email address
# Use Resend's test address (works immediately, no domain verification)
RESEND_FROM_EMAIL=onboarding@resend.dev
# Or use your verified domain (requires DNS setup)
# RESEND_FROM_EMAIL=noreply@yourdomain.com
Test Email Setup
# Check configuration
my-app comms status
# Send test email
my-app comms email send 'your@email.com' --subject 'Test from Aegis Stack' --text 'If you receive this, email is working!'
Twilio (SMS & Voice)
Twilio is the industry standard for programmable SMS and voice communications.
Sign Up
- Go to twilio.com/try-twilio
- Sign up for a free trial
- Verify your phone number (required for trial)
Free Trial
- $15.50 USD trial credit
- SMS: ~$0.0079/message (US)
- Voice: ~$0.0085/minute (US)
- Trial numbers show "Sent from Twilio trial" prefix
Trial Limitations
Trial accounts can only send messages to verified phone numbers. Add your test numbers at console.twilio.com/verified-caller-ids.
Get Credentials
- Go to console.twilio.com
- In the Account Info section, find:
- Account SID (starts with
AC) - Auth Token (click to reveal)
Get a Toll-Free Number (Recommended)
Why Toll-Free?
Toll-free numbers have a simpler verification process than local numbers, which require A2P 10DLC registration. A2P 10DLC registration is not available on trial accounts.
- Go to Phone Numbers > Manage > Buy a Number
- Click Toll-Free tab
- Select a number with SMS and Voice capabilities
- Purchase with trial credit (~$2/month)
Create Messaging Service
Required for toll-free SMS:
- Go to Messaging > Services
- Click Create Messaging Service
- Name it (e.g., "Aegis Stack")
- Select Notify my users as use case
- Click Add Senders > Phone Number
- Select your toll-free number
- Complete setup wizard
- Copy the Messaging Service SID (starts with
MG)
Complete Toll-Free Verification
After adding your toll-free number, you'll see a verification prompt:
- Go to your number's properties
- Click the verification link
- Fill out business info (your name is fine for personal/dev use)
- Describe your use case: "Development testing for application SMS notifications"
- Submit and wait 1-2 business days for approval
Verification Required
You cannot send SMS until toll-free verification is approved.
Environment Variables
# .env
# Required - Your Twilio credentials
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Your toll-free Twilio number (E.164 format)
TWILIO_PHONE_NUMBER=+18001234567
# Required for SMS - Your Messaging Service SID
TWILIO_MESSAGING_SERVICE_SID=MGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Verify Phone Numbers (Trial)
For trial accounts, you must verify recipient numbers:
- Go to console.twilio.com/verified-caller-ids
- Click "Add a new Caller ID"
- Enter the phone number to verify
- Complete verification via call or SMS
Test SMS Setup
# Check configuration
my-app comms status
# Send test SMS (to verified number, after toll-free verification approved)
my-app comms sms send '+1YOUR_VERIFIED_NUMBER' 'Test from Aegis Stack!'
Test Voice Setup
Voice calls work immediately (no toll-free verification needed):
Create Custom Voice Messages (Optional)
To create your own voice messages, use TwiML Bins:
- Go to Develop > TwiML Bins in Twilio Console
- Click Create new TwiML Bin
- Name it (e.g., "Appointment Reminder")
- Add your TwiML:
- Save and copy the URL
- Use it in your calls:
Verify Configuration
After setting up your environment variables, verify everything works:
Expected output:
📧 Communications Service Status
==================================================
📨 Email (Resend)
Status: ✅ Configured
API Key: ✅ Set
From Email: onboarding@resend.dev
📱 SMS (Twilio)
Status: ✅ Configured
Account SID: ✅ Set
Auth Token: ✅ Set
Phone Number: +15551234567
📞 Voice (Twilio)
Status: ✅ Configured
Account SID: ✅ Set
Auth Token: ✅ Set
Phone Number: +15551234567
==================================================
📊 3/3 services configured
Complete Test
Test Email
my-app comms email send 'your@email.com' --subject 'Test from Aegis Stack' --text 'This is a test email from the Communications Service!'
Test SMS
# Note: Trial accounts can only send to verified numbers
my-app comms sms send '+1YOUR_VERIFIED_NUMBER' 'Test SMS from Aegis Stack!'
Test Voice Call
Troubleshooting
Email Issues
Email not delivered - Check spam/junk folder - Verify domain DNS records are correct (production) - Ensure from address matches verified domain - Check Resend dashboard for delivery status
API key invalid - Ensure no extra spaces in environment variable - Regenerate key if compromised - Check key hasn't been revoked
SMS Issues
"Unverified number" error - Trial accounts can only send to verified numbers - Add numbers at console.twilio.com/verified-caller-ids - Upgrade to paid account for unrestricted sending
A2P 10DLC / Error 30034 - Local numbers require A2P 10DLC registration for SMS - A2P 10DLC is not available on trial accounts - Solution: Use a toll-free number instead
Toll-free verification pending - Cannot send SMS until toll-free verification is approved - Check status at your number's properties page - Approval typically takes 1-2 business days
Message not received - Check Twilio console for delivery status - Verify phone number format (E.164: +15551234567) - Check carrier filtering (some block shortcodes) - Ensure Messaging Service SID is configured correctly
Voice Issues
Call not connecting - Verify TwiML URL is accessible - Check Twilio console for call logs - Ensure phone number has Voice capability
No audio on call
- TwiML must contain valid <Say> or <Play> verbs
- Check TwiML syntax at twilio.com/docs/voice/twiml
Provider Documentation
- Resend: resend.com/docs
- Twilio SMS: twilio.com/docs/sms
- Twilio Voice: twilio.com/docs/voice
Cost Estimates
Resend Pricing
| Plan | Price | Emails/Month |
|---|---|---|
| Free | $0 | 3,000 |
| Pro | $20/mo | 50,000 |
| Enterprise | Custom | Unlimited |
Twilio Pricing (US)
| Service | Price |
|---|---|
| SMS Outbound | $0.0079/message |
| SMS Inbound | $0.0079/message |
| Voice Outbound | $0.0085/minute |
| Voice Inbound | $0.0085/minute |
| Phone Number | $1.15/month |
Prices vary by country. Check provider websites for current rates.