Skip to main content
All CollectionsActions & Integrations
Error 21211 When Using Twilio Integration
Error 21211 When Using Twilio Integration

Troubleshooting Error code 21211 when using Twilio Integration

Updated over a year ago

When encountering Error 21211 in your Twilio integration, it typically indicates an issue with the To number provided in your API request. Below, we outline the possible causes and solutions to resolve this error effectively.


Possible Causes

  1. Invalid Formatting of the To Number

    • The To number supplied is not formatted correctly.

  2. Twilio Number Used for Both To and From

    • You attempted to send a message or place a call from a Twilio number to itself by using the same number for the To and From parameters.

  3. Sending to a Short Code

    • The To number provided corresponds to a Short Code, which cannot accept messages from Twilio numbers.

  4. Sending to an Alphanumeric Sender ID

    • You attempted to send a message to an Alphanumeric Sender ID, which does not support receiving messages.

  5. Invalid Prefix in the To Number

    • When using a Messaging Service, the To number contains an invalid prefix.


Possible Solutions

  1. Format Numbers in E.164

    • Ensure all phone numbers are formatted in E.164 format:

      [+] [country code] [subscriber number including area code]
    • Example: +14155552671.

  2. Verify Country Calling Codes

  3. Avoid Calling or Messaging Twilio Numbers from Themselves

    • Ensure the To and From parameters in your request do not reference the same Twilio number.

  4. Avoid Sending to Short Codes or Alphanumeric Sender IDs

    • Messages to Short Codes or Alphanumeric Sender IDs cannot be sent from Twilio numbers.

  5. Check for Typos or Input Errors

    • Review the To number for any typos or incorrect input methods.

  6. Test API Requests in Twilio Console

    • Use the "Try it out" feature in the Twilio console to test your API request. If this test succeeds, check any third-party integrations for unexpected changes to the To parameter.

  7. Correct Invalid Prefixes When Using Messaging Services

    • Instead of using an invalid prefix, remove it and send directly to the To number in E.164 format. Example:

      [+] [country code] [subscriber number including area code]
    • If the To number accepts RCS messages and an RCS Agent is available in the Messaging Service Sender Pool, it will be selected automatically.


Following these steps should help you resolve Error 21211 and ensure smooth operation of your Twilio integration.

For more information, you can refer to this page

Did this answer your question?