Skip to main content

Send SMS

Sends an SMS text message to a specified phone number using the Twilio API. This node is ideal for notifications, alerts, OTP delivery, and customer communication workflows.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.

Input

  • Connection Id - The Twilio connection identifier from the Connect node. This is optional if you provide credentials directly in the Options.
  • From Number - The Twilio phone number to send the SMS from. Must be in E.164 format (e.g., +14155552671). This must be a phone number you own in your Twilio account.
  • To Number - The recipient's phone number. Must be in E.164 format (e.g., +14155552672).
  • Message - The SMS message content to send. Maximum length is 1,600 characters, but messages longer than 160 characters will be split into multiple segments.

Output

  • Response - The Twilio API response containing message details including:
    • sid - Unique message identifier
    • status - Message status (queued, sent, delivered, failed)
    • to - Recipient phone number
    • from - Sender phone number
    • body - Message content
    • date_created - Timestamp when message was created
    • price - Cost of the message
    • error_code - Error code if message failed
    • error_message - Error description if message failed

Options

  • Account SID - Your Twilio Account SID. This is optional if you're using a Connection Id from the Connect node.
  • Auth Token - Your Twilio Auth Token. This is optional if you're using a Connection Id from the Connect node.
tip

You can use either:

  1. A Connection Id from the Connect node (recommended for multiple operations)
  2. Direct credentials in the Options (convenient for single operations)

Examples

Example 1: Send Notification SMS

Send a simple notification message to a customer:

Inputs:

  • Connection Id: connection_id (from Connect node)
  • From Number: +14155552671
  • To Number: +14155552672
  • Message: Your order #12345 has been shipped and will arrive in 2-3 business days.

Output:

{
"sid": "SM1234567890abcdef1234567890abcdef",
"status": "queued",
"to": "+14155552672",
"from": "+14155552671",
"body": "Your order #12345 has been shipped...",
"date_created": "2024-01-15T10:30:00Z",
"price": "-0.0079",
"price_unit": "USD"
}

Example 2: Bulk SMS from Excel

Send SMS messages to multiple recipients from an Excel spreadsheet:

Flow Structure:

  1. Excel - Read Range - Read contacts from Excel (columns: Name, Phone, Message)
  2. For Each - Loop through each row
  3. Send SMS - Send personalized message to each contact

Configuration:

  • From Number: +14155552671
  • To Number: {{item.Phone}}
  • Message: Hi {{item.Name}}, {{item.Message}}

Example 3: Order Status Alert

Automate order status notifications:

Flow Structure:

  1. Database Query - Get orders with status "shipped"
  2. For Each - Loop through orders
  3. Send SMS - Notify customer

Message Template:

Hello {{customer_name}},

Your order #{{order_id}} has been shipped!
Tracking: {{tracking_number}}

Estimated delivery: {{delivery_date}}

Thank you for your order!

Example 4: SMS with Error Handling

Send SMS with proper error handling:

Flow Structure:

Try
└── Send SMS
├── Success → Log Message Sent
└── Catch → Log Error & Send Alert Email

Error Handling:

  • Catch SMS send failures
  • Log error details from Response output
  • Send notification to admin via email
  • Retry sending if needed

Example 5: Scheduled Reminders

Send scheduled appointment reminders:

Flow Structure:

  1. Schedule Trigger - Run every hour
  2. Database Query - Get appointments in next 24 hours
  3. For Each - Loop through appointments
  4. Send SMS - Send reminder

Message:

Appointment Reminder:
Date: {{appointment_date}}
Time: {{appointment_time}}
Location: {{location}}

Reply CONFIRM to confirm or RESCHEDULE to change.

Tips

  • Phone Number Format - Always use E.164 format: +[country code][number]. For example, US numbers: +1XXXXXXXXXX.
  • Message Length - SMS messages are charged per segment (160 characters). Messages longer than 160 characters are split and cost more.
  • Rate Limits - Twilio has rate limits. For bulk SMS, add delays between messages or use Twilio's Messaging Service.
  • Delivery Status - Check the status field in the Response output to verify delivery: queued, sent, delivered, failed.
  • Cost Tracking - Monitor the price field in responses to track SMS costs.
  • Test Mode - Use Twilio's verified phone numbers for testing before sending to customers.
  • URL Shortening - Long URLs in messages count toward character limit. Consider using a URL shortener.
  • Personalization - Use variables from your data source to personalize messages (e.g., customer name, order ID).

Common Errors

Empty From/To Number

Error: "ErrInvalidArg: From Number cannot be empty" or "To Number cannot be empty"

Solution:

  • Ensure both From Number and To Number fields are populated
  • Check that your data source contains valid phone numbers
  • Verify the variable names match your flow data

Empty Message

Error: "ErrInvalidArg: Message cannot be empty"

Solution:

  • Ensure the Message field contains text
  • Check that message variables are properly populated
  • Verify your message template has content

Invalid Phone Number Format

Error: "ErrCreateMessage: Error sending message: Invalid 'To' Phone Number"

Solution:

  • Use E.164 format: +[country code][number]
  • Remove spaces, dashes, or parentheses from phone numbers
  • Ensure country code is included (e.g., +1 for US/Canada)
  • Example: +14155552671 (correct), 415-555-2671 (incorrect)

Unverified Number (Trial Account)

Error: "The number +XXXXXXXXXX is unverified. Trial accounts cannot send messages to unverified numbers"

Solution:

  • Add the recipient number to verified phone numbers in Twilio Console
  • Upgrade your Twilio account from trial to paid
  • Use verified phone numbers for testing

Invalid From Number

Error: "The From number +XXXXXXXXXX is not a valid phone number, shortcode, or alphanumeric sender ID"

Solution:

  • Ensure the From Number is a phone number you own in your Twilio account
  • Purchase a phone number from Twilio Console if needed
  • Verify the phone number is configured for SMS messaging
  • Check that the number is in E.164 format

Authentication Failed

Error: Authentication or credential errors

Solution:

  • Verify your Connection Id is valid (from Connect node output)
  • If using direct credentials, check Account SID and Auth Token are correct
  • Ensure credentials are stored properly in Vault
  • Verify your Twilio account is active and in good standing

Insufficient Balance

Error: "Account not authorized to send SMS" or similar billing error

Solution:

  • Check your Twilio account balance in the Console
  • Add funds to your account if balance is low
  • Review your account status and ensure it's not suspended
  • Contact Twilio support if billing issues persist