Emergent

Building Your App › Integrations

Twilio Integration

Send SMS messages and phone calls with Twilio

What is Twilio?

Twilio lets you send text messages (SMS), make phone calls, and even send WhatsApp messages from your app. It's the most popular service for adding phone/SMS features.

Perfect for:

  • SMS notifications and alerts
  • Two-factor authentication (2FA)
  • Phone verification
  • Order updates
  • Appointment reminders

What You'll Need

1

Twilio Account

Sign up at twilio.com - free trial available!

2

Phone Number

Get a Twilio phone number

3

API Keys

Copy your credentials

4

10 Minutes

Quick setup!

Step 1: Get Your Twilio Credentials

Create Account

  1. Go to twilio.com/try-twilio
  2. Sign up for free
  3. Verify your email and phone
  4. You get $15 free credit!

Get a Phone Number

  1. In Twilio Console
  2. Go to Phone NumbersManageBuy a number
  3. Select your country
  4. Check: SMS (and Voice if needed)
  5. Click Buy (uses your free credit)
  6. Copy your new phone number

Get Your API Credentials

On the Twilio dashboard, you'll see:

Account SID

Starts with: AC

Example: ACxxxxxxxx

Identifies your account

Auth Token

Random string

Secret! Keep it safe

Click to reveal it

Copy both - you'll need them!

Note

Trial Account Limits: You can only send to verified phone numbers. Upgrade to send to anyone.

Step 2: Tell the Agent What You Want

Describe what you need:

Example 1: SMS Notifications

I need to send SMS notifications to users.

Twilio credentials:
- Account SID: ACxxxxxxxx
- Auth Token: xxxxxxxx
- Phone Number: +1234567890

Features:
- Send order confirmations via SMS
- Send shipping updates
- Send account alerts

Please set this up.

Example 2: Phone Verification (2FA)

I need phone number verification for user signup.

Twilio credentials:
- Account SID: ACxxxxxxxx
- Auth Token: xxxxxxxx  
- Phone Number: +1234567890

Flow:
1. User enters their phone number
2. Send 6-digit code via SMS
3. User enters code
4. Verify and activate account

Features:
- Code expires in 5 minutes
- Limit resend attempts
- Show countdown timer

Please build this.

Example 3: Appointment Reminders

Send SMS reminders for appointments.

Twilio credentials:
- Account SID: ACxxxxxxxx
- Auth Token: xxxxxxxx
- Phone Number: +1234567890

Reminders:
- 24 hours before appointment
- 2 hours before appointment
- Include appointment details

Please set this up.

Tip

That's all! The agent will set up SMS sending, verification codes, everything.

Step 3: Test SMS Sending

For Trial Accounts

1

Verify Your Phone

In Twilio Console → Phone NumbersVerified Caller IDs

Add your personal phone number

2

Click Preview

In Emergent, click Preview

3

Send Test SMS

Try sending an SMS to your verified number

4

Check Phone

You should receive the text message!

After Upgrade

Once you upgrade (add payment method), you can send to any phone number!

Step 4: Go Live (Upgrade Account)

To send to anyone (not just verified numbers):

1

Upgrade Account

In Twilio Console → Upgrade

2

Add Payment

Add credit card

3

Complete Upgrade

Follow the steps

4

Start Sending!

Now you can send to any number

Common Questions

</Accordion> ## Something Not Working?

SMS Not Sending

Tell the agent:

SMS messages aren't sending. Error:
[paste error message]

Can you check the Twilio setup?

"Unverified Number" Error

Tell the agent:

Getting "unverified number" errors.

I'm on trial account - can you:
1. Add instructions for users to verify their number
2. Or remind me I need to upgrade

Wrong Phone Format

Tell the agent:

Users entering phone numbers wrong.

Can you:
1. Auto-format phone numbers
2. Add country code selector
3. Validate format before sending

Real Examples

Example 1: E-commerce Order Updates

Send SMS for order status updates.

Twilio credentials: [will provide]

Messages to send:
- Order placed confirmation
- Payment received
- Shipped (with tracking)
- Out for delivery
- Delivered

Each SMS should include:
- Customer name
- Order number
- Relevant details

Please build this.

Example 2: Two-Factor Authentication

Add 2FA to user login.

Twilio credentials: [will provide]

Flow:
1. User logs in with password
2. Send 6-digit code via SMS
3. User enters code
4. Grant access if correct

Security:
- Code expires in 5 minutes
- Max 3 attempts
- Rate limiting

Please set this up.

Example 3: Booking Reminders

SMS reminders for bookings.

Twilio credentials: [will provide]

Send reminders:
- When booking is confirmed
- 1 day before
- 1 hour before

Include:
- Booking details
- Date/time
- Location/link
- Cancel/reschedule option

Please build this.

Advanced Features

Once basic SMS works:

Delivery Tracking

Track SMS delivery status:
- Sent
- Delivered
- Failed
- Read (if available)

Show status in admin dashboard.

Two-Way SMS

Users can reply to SMS messages.
Handle their responses in the app.

Scheduled Messages

Schedule SMS to send later:
- Daily reminders at 9 AM
- Birthday messages
- Appointment reminders

Quick Checklist

Before going live:

  • Tested SMS on verified number
  • Messages arrive within seconds
  • Text format looks good
  • Links work (if included)
  • Phone validation works
  • Upgraded account (if sending to all numbers)
  • Set spending limits in Twilio

Remember

Free trial includes $15 credit - Good for ~2,000 SMS

Very affordable - Most apps spend under $20/month

Upgrade to reach everyone - Trial only sends to verified numbers

Track delivery - Know if messages were received

Set spending limits - Avoid surprise bills

Info

Stuck? Tell the agent: "I need help with Twilio SMS" and explain what's not working.

Made with Emergent