Back to Play 8 Resources
Play 8: Emergency Response

Twilio SMS Integration Guide for n8n

Twilio account setup, phone number config, n8n Twilio node configuration.

Twilio SMS Integration Guide for n8n

You need SMS alerts that fire when systems fail, clients escalate, or deadlines hit. Twilio + n8n gives you programmable SMS without writing code. This guide walks you through account setup, phone number configuration, and n8n node setup with exact steps and real-world examples.

What You Need Before Starting

  • n8n instance (self-hosted or n8n.cloud account)
  • Credit card for Twilio verification (free trial gives you $15.50 credit)
  • 10 minutes for setup
  • Target phone numbers for testing (your mobile works fine)

Step 1: Create and Configure Your Twilio Account

1. Sign up at twilio.com/try-twilio

Click "Sign up and start building". Enter your email, create a password. Twilio sends a verification email immediately.

2. Verify your phone number

Twilio texts you a 6-digit code. Enter it. This number becomes your first verified recipient for testing.

3. Complete the questionnaire

Select "Alerts & Notifications" as your use case. Choose "With code" for implementation method. Skip the team size question.

4. Grab your credentials

Land on the Twilio Console dashboard. You see two critical values in the "Account Info" panel:

  • Account SID (starts with "AC")
  • Auth Token (click the eye icon to reveal)

Copy both to a secure note. You need these for n8n authentication.

5. Understand trial limitations

Trial accounts can only send SMS to verified phone numbers. You must verify each recipient number manually in the console before sending. Upgrade to a paid account ($20 minimum) to remove this restriction.

Step 2: Buy and Configure a Phone Number

1. Navigate to Phone Numbers > Manage > Buy a number

Search by country and capabilities. Check "SMS" under capabilities filter.

2. Select a number type

  • Local numbers: $1/month, best for regional firms
  • Toll-free numbers: $2/month, better for national reach
  • Short codes: $1000+/month, only for high-volume operations

For most professional services firms, a local number works fine.

3. Purchase the number

Click "Buy" on your chosen number. Twilio charges your account immediately. Write down the full number in E.164 format (example: +14155551234).

4. Configure messaging settings

Click into your new phone number. Scroll to "Messaging Configuration". Leave "Configure with" set to "Webhooks

, TwiML Bins, Functions, Studio, or Proxy". You'll handle message routing in n8n, not Twilio.

5. Verify recipient numbers (trial accounts only)

Go to Phone Numbers > Manage > Verified Caller IDs. Click the red plus button. Enter each phone number that should receive test messages. Twilio calls the number with a verification code.

Step 3: Connect Twilio to n8n

1. Open your n8n workflow editor

Create a new workflow or open an existing emergency response workflow.

2. Add a Twilio node

Search for "Twilio" in the node panel. Drag the "Twilio" node onto the canvas.

3. Create credentials

Click the "Credential to connect with" dropdown. Select "Create New Credentials". A modal opens.

Enter these exact values:

  • Credential Name: "Twilio Production" (or "Twilio Test" for trial accounts)
  • Account SID: Paste your AC-prefixed SID from Step 1
  • Auth Token: Paste your auth token from Step 1

Click "Create". The modal closes.

4. Configure the SMS operation

In the Twilio node settings:

  • Operation: Select "Send SMS"
  • From: Enter your Twilio number from Step 2 (include the + prefix)
  • To: Enter the recipient number in E.164 format (+14155551234)
  • Message: Type your test message or use an expression

5. Test the connection

Add a Manual Trigger node before your Twilio node. Connect them. Click "Execute Workflow". Check your phone. You should receive the SMS within 5 seconds.

If you get an error "The number +1XXXXXXXXXX is unverified", you're on a trial account and forgot to verify the recipient in Step 2.5.

Step 4: Build an Emergency Alert Workflow

Here's a production-ready workflow that sends SMS alerts when a webhook receives an emergency signal.

Node 1: Webhook

Trigger

  • Method: POST
  • Path: emergency-alert
  • Authentication: Header Auth (create a secret token)

Node 2: Set Variables

Extract data from the webhook

payload:

`{{ $json.body.incident_type }}`
`{{ $json.body.location }}`
`{{ $json.body.severity }}`
`{{ $json.body.reported_by }}`

Node 3: Function Node (Format Message)

const severity = $input.item.json.severity.toUpperCase();
const incident = $input.item.json.incident_type;
const location = $input.item.json.location;
const reporter = $input.item.json.reported_by;
const timestamp = new Date().toLocaleString('en-US', { 
  timeZone: 'America/New_York' 
});

return {
  json: {
    message: `[${severity}] ${incident} at ${location}. Reported by ${reporter} at ${timestamp}. Respond immediately.`,
    recipients: ['+14155551234', '+14155555678'] // Replace with real numbers
  }
};

Node 4: Split In Batches

  • Batch Size: 1
  • Options > Reset: true

This sends one SMS per recipient instead of failing on the first number.

Node 5: Twilio SMS

  • From: Your Twilio number
  • To: {{ $json.recipients }}
  • Message: {{ $json.message }}

Node 6: Set Status

Track delivery:

`{{ $json.sid }}` - Sent to `{{ $json.to }}` at `{{ $now }}`

Node 7: Append to Google Sheet (optional)

Log all alerts to a spreadsheet for audit trails.

Step 5: Handle Common Issues

"Unverified number" error

Trial account limitation. Either verify the number in Twilio Console or upgrade to a paid account.

"Invalid 'From' phone number"

You entered the number without the + prefix or used a non-SMS-capable number. Check Phone Numbers > Manage > Active Numbers in Twilio Console.

Messages delayed by 30+ seconds

Twilio's free tier has lower priority routing. Upgrade to a paid account for sub-5-second delivery.

"Exceeded send rate limit"

Trial accounts: 1 message per second. Paid accounts: 10 messages per second (adjustable). Add a Wait node between messages or request a rate increase from Twilio support.

International SMS not working

Enable international permissions in Twilio Console > Messaging > Settings > Geo Permissions. Select allowed countries.

Step 6: Production Hardening

Set up error handling

Add an Error Trigger node that catches failed Twilio sends. Route failures to a Slack channel or email alert.

Implement retry logic

Add a Loop node that retries failed sends up to 3 times with 10-second delays.

Monitor usage

Create a scheduled workflow that hits Twilio's API daily to check message counts and remaining balance. Alert when balance drops below $10.

Rotate credentials

Generate a new Auth Token every 90 days. Update n8n credentials immediately. Twilio allows two active tokens during rotation.

Test monthly

Schedule a test alert on the first Monday of each month. Verify all recipients receive it. Update the recipient list as staff changes.

Cost Planning

Typical costs for a 50-person firm:

  • Phone number: $1/month (local) or $2/month (toll-free)
  • Outbound SMS (US/Canada): $0.0079 per message
  • Inbound SMS: $0.0079 per message
  • Monthly estimate: $5-15 for occasional emergency alerts

Budget $50/month if you send daily status updates or have 100+ recipients.

Next Steps

You now have working SMS alerts. Extend this setup by:

  • Adding conditional logic to route different severity levels to different groups
  • Integrating with your practice management system's API
    to pull on-call schedules
  • Creating SMS-based acknowledgment workflows where recipients text back "ACK" to confirm receipt
  • Building a two-way SMS interface for status updates during extended incidents

Test your workflow with a real emergency scenario this week. Send a test alert to your team and measure response time. Adjust recipient lists and message templates based on feedback.

Revenue Institute

Reviewed by Revenue Institute

This guide is actively maintained and reviewed by the implementation experts at Revenue Institute. As the creators of The AI Workforce Playbook, we test and deploy these exact frameworks for professional services firms scaling without new headcount.

Revenue Institute

Need help turning this guide into reality? Revenue Institute builds and implements the AI workforce for professional services firms.

RevenueInstitute.com