Twilio (SMS)

Types of vendor errors for Twilio (SMS) and their resolutions

In this guide, we'll cover all the errors returned by the vendor when SuprSend initiates a send call to the vendor. In case of vendor error, you'll see Trigger failed or Failure by Vendor status in the third step of the logs. Hover over the failed chip to access the specific error message.

ErrorHow to solve?
Status: 400 - ApiError 21211: The 'To' number xxxx is not a valid phone number.Possible causes:

- You attempted to initiate text to the phone number which is invalid or was incorrectly formatted. Twilio accepts phone numbers in E164 format: [+] [country code] [subscriber number including area code]

- You tried to send a message from a Twilio phone number to itself (from and to numbers in the request are same)Solutions:

- Verify phone number has country code attached to it. Eg. +14155552671

- Check if the country code for the phone number is correct.

- Verify that the From and To numbers in the request are not same.
21610: failedPossible cause:
The person you are trying to message has opted out of receiving messages from your Twilio phone number by responding with opt-out keywords like STOP. You'll not be able to send messages to this number unless user resubscribes to the messages by texting opt-in keywords like START

Solutions:

- Try adding a preference centre in your application for users to explicitly define what notifications they want to receive and on which channel, so that you don't end up losing touch with the user on the entire channel out of notification fatigue.
- Try adding multi-channel communication so that you can reach out to users on other active channels when they disengage from SMS. You can also request the recipient to resubscribe to your messages by reaching out on other channels.
- Before sending messages to a recipient, ensure they have consented to receive messages from you. Please read these guidelines to understand messaging opt-in requirements and best practices.
30006: undeliveredPossible cause:
The destination number is unable to receive this message. Potential reasons could include trying to reach a landline or, in the case of short codes, an unreachable carrier.

Solution:
Use the Lookup API to determine if the number is indeed a landline. If is not, try with an alternative phone number type.
30003: undeliveredTo number is unreachable.

Possible causes:

- The destination handset you are trying to reach is switched off, out of network zone or unavailable.
- The device cannot receive SMS (for example, the phone number belongs to a landline)
- There is an issue with the mobile carrierSolutions:Try sending the message later when the user will be reachable. You can also setup channel routing so that user gets notification on the next best channel if SMS is unreachable.
21614: failedPossible causes:

- The number that you are trying to send message to is invalid or incorrectly formatted. Twilio accepts phone numbers in E164 format: [+] [country code] [subscriber number including area code]

- The number you provided may be a landline number.

- If you are attempting to send SMS to Internet of Things (IoT) or machine-to-machine (M2M) numbers, the numbers may use a non-standard format that Twilio has not added to their number validation system yet.Solutions:

- Verify phone number has country code attached to it. Eg. +14155552671

- Check if the country code for the phone number is correct.

- Confirm that the number you are sending to is not a landline, using the Lookup API.

- If you are attempting to send SMS to an IoT or M2M number, check whether the number format is different from the standard mobile numbers in that country or locality. Often, these numbers have additional digits or unusual formats which do not pass Twilio's number validation. If you believe this is the issue, please contact Twilio Support for assistance.
Status: 401 - ApiError 20003: AuthenticatePossible causes:
Twilio authentication credentials added in vendor form is not correct. It could happen if you are

- using the wrong combination of Account SID and Auth Token or previous auth token or API key has been deleted.,
- using test credentials to send notification to live users
- using subaccount credentials to access master account
- account is suspended or closed
- extra characters or spaces in the supplied credentials
- Attempted API Key is for the incorrect Twilio RegionSolution:
Verify all details mentioned above. Refer twilio vendor integration guide for more details.
30007: undeliveredPossible cause:
Your message content was flagged or filtered (blocked) by Twilio or by the carrier. This may be done by Twilio for violating Twilio’s Messaging Policy or Acceptable Use Policy, or by a wireless carrier for violating carrier rules or regulations.

Examples of messaging that would be blocked by Twilio are spam, phishing, and fraud. Twilio’s filtering system is in place to protect mobile subscribers from spam or other forms of malicious or unwanted messages.

Solutions:

- Ensure your messaging use case complies with Twilio's Messaging Policy or Acceptable Use Policy
- Review the information in How Does Message Filtering Work? to understand what causes filtering.
- See How do I prevent my Twilio messages from being filtered (blocked)? for specific tips on avoiding message filtering.
- If you believe your messages are compliant with Twilio and carrier policies, please collect 3 or more examples of Message SIDs that have the “undelivered” status with error 30007, and then contact twilio Support team.
30008: undeliveredCause:
Unknown error

Possible Solutions:

- Check that the phone you were sending to is turned on
- Ensure that the phone is not roaming off network. Twilio doesn't guarantee message delivery on roaming phones.
- Try sending to other phones who have the same mobile carrier (you can use our Lookup API to determine the carrier if you’re unsure). If messages to other phones go through, the issue is likely device related. Try rebooting the device or contact the mobile carrier for help.
- If you are sending SMS from an alphanumeric sender ID, see if using a Twilio phone number works better. We’ve observed that certain networks may block alpha sender IDs.
- If the recipient number is another Twilio number, ensure that number has an action configured for its Messaging capabilities. Choose any available option like "Webhook" or "TwiML Bin."
- Try sending a shorter message to the phone, with simple content that does not include any special characters to verify whether the failure is related to concatenation or character encoding.If the issue still persists, try reaching out to Twilio support team.
Status: 400 - ApiError 21705: The Messaging Service Sid xxxx is invalid.Possible cause:
The messaging service SID is not valid or doesn't contain any sender. A Messaging Service requires at least one phone number, Alphanumeric Sender ID or short code to send messages.

Solution:
Add a sender to the messaging service or add the correct messaging SID.
30005: undeliveredTo number you are trying to reach is unknown and may no longer exist.

Possible causes:

- The destination number you are trying to reach is unknown and may no longer exist.
- The destination handset you are trying to reach is switched off, out of network zone or unavailable.
- The device cannot receive SMS (for example, the phone number belongs to a landline)
- There is an issue with the mobile carrierSolutions:Try sending the message later when the user will be reachable. You can also setup channel routing so that user gets notification on the next best channel if SMS is unreachable.
30034: undelivered; 30034: failedPossible cause:
You are sending messages to the US using a US 10DLC number that is not associated with an approved A2P 10DLC Campaign. Messages sent to US numbers will not be delivered if they are sent from numbers that are not associated with an approved A2P 10DLC Campaign. This guide will help you determine if you have completed registration for A2P 10DLC.

Solution:
Associate your US 10DLC number with a registered A2P Campaign by adding it to the corresponding Messaging Service via the Twilio Console or API. Find out how to register using this guide.

For a step-by-step walkthrough, check out this video on resolving Error 30034.
Status: 400 - ApiError 21617: The concatenated message body exceeds the 1600 character limit.Possible cause:
The message body exceeds maximum allowable text length of 1600 characters. Some glyphs such as Emoji, Emoticons or other special characters will be counted as multiple.

Solution:
Try reducing the text length or split it into multiple messages.
21612: failedYou have attempted to send to a number that is not currently reachable via Twilio SMS.

Possible causes:

- Sender ID restrictions in the destination country: Many countries limit which numbers, short-codes, and/or alphanumeric senders can be used in that region. Consult the SMS guidelines for the destination region.

- Alphanumeric senderIDs: If you are using an alphanumeric sender ID, the 'To' number must be in a country where alphanumeric sender IDs are supported. Certain countries require pre-registration of alphanumeric sender IDs. A list of countries where alphanumeric sender ID is supported and whether or not pre-registration is required can be found here.

- Number formatting: The To or From in your message is incorrectly formatted. Twilio accepts phone numbers in E164 format: `[+] [country code]

- Twilio does not yet have service with the carrier you are trying to reach. You can lookup the destination network via the lookup api.Solution:
Consult the linked documentation for each cause and update "To" and "From" number accordingly.
21408: failedPermission to send an SMS has not been enabled for the region indicated by the 'To' number.

Possible cause:
You have attempted to send an SMS to a region that has not been enabled in your Twilio account's Geo-Permissions settings.

Solution:
If you wish to send messages to this region, please enable the relevant permissions on your account using the Messaging Geographic Permissions page.
30410: undeliveredPossible cause:
The messaging service SID doesn't contain any sender. A Messaging Service requires at least one phone number, Alphanumeric Sender ID or short code to send messages.

Solution:
Add a sender to the messaging service or add the correct messaging SID.
21704: failedPossible cause:
The provider used may be experiencing disruptions resulting in errors or request timeouts. Messages are failed and not retried to avoid duplicate message delivery.

Solution:
Please attempt to send messages at a later time. You can also setup channel routing so that user gets notification on the next best channel if SMS is unreachable.

Refer to all possible twilio errors here.