SMS Delivery Fails with Some Phone Numbers when Twilio is the SMS Provider "21211 Invalid 'to' phone number"
Users report that SMS messages are no longer delivered. The error message received is:
21211 Invalid 'to' phone number.
- Users report non-delivery of SMS messages and are presented with the error "21211 Invalid 'to' phone number". This problem may occur randomly or be present for an extended period of time.
- The problem may impact only a single number or a small number of phone numbers. Most SMS message deliveries to non-affected numbers result in successful 'SMS Sent' events.
- Twilio
- SMS Delivery Failed
The 21211 error is specific to the Twilio SMS service.
In this example, the SMS message service uses the built-in SMS provider. Auth0 has a basic account with Twilio for this purpose.
Note that this problem may also be experienced by customers that have a paid subscription to Twilio.
First, consider the case of Using the built-in provider: This facility is intended only to enable testing of the most basic SMS functionality. Auth0 does not provide any kind of guarantees as to reliability or quality of service. The built-in provider should not be used in a Production environment. Furthermore, it has a limit of 100 messages for the lifetime of the tenant. This is explained in our public documentation: Configure SMS and Voice Notifications for MFA - Use the Dashboard
"Auth0: You can't use this provider to send voice messages. Sends SMS messages using Auth0's internally-configured SMS delivery provider. It can be used for evaluation and testing purposes only, and there is a maximum of 100 messages per tenant during the entire tenant's lifetime. New codes are not received after reaching the 100 message limit."
The first recommendation would be to upgrade to using a dedicated SMS provider. This can be either Twilio or one of the other supported providers: Configure SMS and Voice Notifications for MFA - Integrated SMS messaging providers
A paid subscription to an SMS provider should normally include access to technical support, service logs, and the service knowledge base.
Second, regarding how to respond to the specific '21211' error, if the precise answer cannot be easily found in the Twilio logs or knowledge base, create a ticket with Twilio's help desk and inquire as to why SMS message deliveries appear to be failing for that specific number. This is not something that Auth0 can assist with.
Check the Twilio API reference to understand the nature of the error Error Sending MFA SMS.
Customers with a paid subscription or a trial subscription with Auth0 should open a support ticket in the Support Center with details of the error they have seen. Not all 'invalid phone number' types or errors may originate with Twilio (or other SMS providers).
Free tenant customers should post a question to our Community page.