Plivo can identify invalid and non-SMS-enabled destination numbers. Since we don’t accept for delivery messages sent to invalid destination numbers, we do not charge for them. We can also fix an incorrectly formatted destination numbers to improve delivery rates and provide a better end-user experience.
Synchronous handling for invalid numbers
Customers can propagate an invalidation error upstream easily, since SMS API requests to invalid and non-SMS-enabled numbers are rejected with a 400 Bad Request API response. Here’s an example of how this works in a one-time password (OTP) use case:
Step 1: A user requests an OTP on an invalid destination number.
Step 2: The customer initiates a Send SMS API request.
Step 3: Plivo returns 400 Bad Request response synchronously.
Step 4: The customer displays an "invalid number" error to the user.
Format correction for phone numbers
Plivo can intelligently reformat incorrectly formatted phone numbers. Here are two scenarios to illustrate how this works.
Scenario 1: A user enters the Lithuanian number 370860112345. Plivo automatically reformats the number to the E.164 international format +37060112345 before forwarding the message to downstream carriers. Notice the 8 has been removed in the formatted number. This is because Plivo recognizes that 8 is required only when dialing a Lithuanian number from inside Lithuania.
Scenario 2: A user enters the Mexico number 520455512345678. Plivo automatically reformats the number to E.164 international format +5215512345678. Notice that 045 has been replaced with 1. This is because 045 is only to be used when dialing a domestic cell phone from a landline, and 521 is the prefix for mobile phone numbers in E.164 format.
Enabling Enhanced Destination Number Validation
- All new Plivo customers have Enhanced Destination Number Validation for SMS enabled by default.
- Existing customers can enable Enhanced Destination Number Validation for SMS from the SMS Settings page of the Plivo console. We recommend that all of our customers enable this feature.
Note: Because landlines in the US, Canada, and the UK can be enabled for SMS, Plivo will not reject SMS messages to landline numbers in these countries.