Pass the menu and read the page

SignupFolio

Phone number format: 4 checks for a signup text sender

For signup texts, normalize the phone number, require a country code, check opt-outs before sending, and confirm delivery afterward.

Key takeaways

  • Store each number in a consistent format with a country code.
  • Preserve opt-out records when someone submits the form again.
  • Track final delivery status separately from send acceptance.
  • Test error handling before launch.

Why the phone field causes trouble

A signup form looks simple. A person types a number, clicks submit, and your SMS API sends a welcome text. In practice, the phone field is where many silent failures start. People type spaces, dashes, brackets, a leading plus, or nothing at all. Some paste in a number with a country code and some leave it off. The form accepts all of it, and the text sender receives whatever string made it through.

The API then has to decide what to do with that string. Some APIs are forgiving and some are strict. Some return an error you can see right away. Others accept the request and then fail later, when the message never reaches the phone. The second kind is harder to catch, because your code got a success response and the form looked fine.

This post covers three checks before sending and a delivery check afterward. None of them is hard to build. Each one prevents a kind of failure that marketers often find only after a campaign has gone out with holes in it: missing texts, duplicate contacts, people who keep getting messages they asked to stop, and reports that say "sent" when nothing arrived.

The examples below come from the public docs of three SMS providers. Each provider has its own details, and those details change, so check the current docs for the provider you use before you copy any rule here. The links point to the pages I drew from.

Check 1: Normalize the format before you store it

Start by cleaning the input. Remove spaces, dashes, dots, and parentheses. Keep the digits and, if present, the leading plus sign. Do this on the server, not only in the browser, because a browser script can be skipped or changed.

Each provider defines the format it wants. Telnyx's send-message guide is clear about its requirement. It says: "Both from and to must be in E.164 format: +15551234567." That is the shape you should aim to store: a plus sign, the country code, and the rest of the digits in one unbroken string. Telnyx, Send Your First Message

Sinch's API reference describes several accepted input forms. It says: "Phone numbers can be sent with or without a leading + (for example, +123456789 or 123456789 are both valid) or with a leading 00." Sinch, API Reference for the SMS API

Those two statements do not conflict. Sinch accepts several forms, and Telnyx wants one. The safest approach is to pick one canonical form, store every number in that form, and convert it on the way out if a provider needs something different. Using the E.164 shape from the Telnyx example gives you a format that both Telnyx and Sinch accept.

Pay attention to the leading 00. A number written with 00 in front of the country code is another way of writing the same number. If a user types 00 followed by a country code, convert the 00 to a plus sign before you store it. Sinch accepts both forms, but your database should not hold both for the same person. If it does, you end up with duplicate records and duplicate sends.

There is one more detail that trips up many teams. Sinch says that numbers returned by its REST API come back "without a + or 00 prefix, even if they were sent with one." So if you compare a stored number with a number from an API response, remove the plus sign or the 00 from both sides before you compare. Otherwise a true match looks like a mismatch, and your code creates a second record for someone who is already in your list.

Test this check with a short list of inputs. A good starter set includes a number with spaces, a number with dashes and brackets, a number with a plus, a number with a leading 00, and a number with a trailing space pasted in from a contact card. All five should end up as the same stored value.

Illustrative example: duplicate inputs

After cleaning and comparison, they should match 1 stored number. If they create separate records, inspect the formatting step before testing the sender.

Check 2: Require a country code

This is the check most signup forms skip. A number without a country code can look valid and still point to the wrong country, or to no country at all. A text sender cannot choose the right route for it. If the form has a country selector, the selector should write the country code into the stored value. If the form has no selector, reject any input that does not begin with a plus sign or with 00 followed by a country code.

Be careful with a leading zero. Some people write a national number with a leading zero, and the form should not guess what that zero means. Do not guess what the zero means and do not silently remove it. Ask the person to pick their country from a list, then build the stored value from that choice and the digits they typed. A visible country field is clearer than any clever parsing rule, and it is easier to explain to a customer who asks why their number was rejected.

Keep the validation general. It is tempting to write a full rulebook into the form, with patterns for every country. Those rules change, and a long list goes stale quickly. A few clear rules are easier to maintain: a canonical format, a required country code, and digits only after the code. Anything beyond that belongs in your provider's error handling, where the provider can tell you what it actually rejected.

Test this check with a few real examples. Enter the same number with a plus sign, with 00, and with a country chosen from the list. All three should produce the same stored value. Then enter a number with no country code and confirm the form asks for one before it submits.

Check 3: Respect opt-outs before you send

Format is only half the job. A correctly formatted number can still belong to someone who asked you to stop texting. If you send to that number anyway, the provider may refuse the message, and a poor handling of that refusal can cause repeated attempts that look like spam.

Twilio's Advanced Opt-Out documentation describes what happens after a user opts out. It says: "Any subsequent outgoing messages from your account to this user will fail with Error Code 21610 asynchronously." Twilio, Customize users' opt-in and opt-out experience with Advanced Opt-Out

The word "asynchronously" matters. The failure does not always come back in the response to the send call. The failure can arrive after the send call has returned. Your code has to handle that later signal, not only the immediate response. If you only check the first response, you will miss opt-outs that were recorded after the message was queued.

Practical steps for this check:

  • Keep an opt-out flag on the contact record. Store it separately from the phone number itself, so a changed number does not wipe the history.
  • When you receive an opt-out error, set the flag and stop sending to that number. Do not retry.
  • Before every campaign, check the flag in your own system. Do not rely only on the provider to block the send, because your own list should never ask for a send it knows is blocked.
  • Record the date and source of each opt-out. When someone asks why they were not texted, you need a clear answer.

Signup forms bring a specific risk. A person who opted out may come back and submit the form again, perhaps by mistake or because they want to hear from you. Your form should not silently clear an opt-out just because someone entered the number again. Read the stored state first, and make a deliberate decision about what a new submission means. A new signup should not override a stop request without a clear, recorded choice from the person.

Check 4: Confirm delivery, not just acceptance

A success response from an API means the request was accepted. It does not mean the message reached the phone. This is one of the most common sources of confusion in a signup flow, because the form looks complete and the dashboard shows a sent count that feels like proof.

Telnyx's guide makes the point directly: "If the API returns 200 but the message doesn't arrive, check message.finalized webhook events for delivery failure details." Telnyx, Send Your First Message

To use that, you need a webhook. The same guide says: "Set up an endpoint to receive webhook POST requests and return a 200 response." Telnyx, Send Your First Message

A practical setup looks like this:

  1. Build a small endpoint on your server that accepts POST requests from your provider.
  2. Have it return a 200 response, then process the event. Keep the handler simple so the response goes out without fuss.
  3. Log each message's final status against the contact record, so you can see which signups actually received a text.
  4. Build a list of failed deliveries and review it. A failure may mean a typo, a number that cannot receive texts, or an opt-out you did not catch. Each cause calls for a different fix.

Run the delivery check on a schedule, not only on the day you build the form. Phone numbers change hands over time, and a number that worked at signup may fail months later. A weekly review of the failure list catches those cases while the list is still small.

Be careful with how you report results. Marketers often see a send count and assume it equals reach. A send count measures what you asked the API to do. A delivery status measures what happened. Report both, label them clearly, and do not present the first as proof of the second.

Also watch: rate limits and credentials

The four checks cover the number. Two more things often break signup texts once traffic grows, and both show up as errors that look unrelated to the phone field.

Rate limits come first. Telnyx documents what happens when you send too quickly: "When you exceed the limit, the API returns 429 Too Many Requests with a retry-after header." Telnyx, Send Your First Message Your sender should read that header and wait before it tries again. If it does not, a signup spike can turn into a stream of failed sends and retries that make the problem worse. The fix is to queue the sends rather than firing one API call for each form submit at the same moment. For related form-level testing, see the signup load test checklist.

Credentials come second. Sinch says to put the credential in the Authorization header of each endpoint, preceded by Bearer. Sinch, API Reference for the SMS API If your signup code builds that header by hand, test it once in a safe environment before you go live. A small mistake in that header can cause authentication to fail on every send. A form that quietly fails is hard to notice, especially when the people who would report the problem are the ones who never got the text.

Keep API keys off the front end. The form should post the number to your server, and your server should make the SMS call. That keeps credentials private and lets you apply the four checks in one place, where they cannot be bypassed by a browser console or an old copy of the form.

A simple order of operations

Put the checks in a fixed order, so each step gets clean input from the step before it:

  1. Clean the input and convert it to your canonical format.
  2. Confirm that a country code is present. If it is not, stop and ask the person to choose one.
  3. Check the opt-out flag. If it is set, do not send.
  4. Send the message, record the immediate response, and wait for the delivery webhook to report the final status.

Keep this logic in one function on your server. If the form, the sender, and the webhook handler each do their own version of the cleaning, the three versions will drift apart over time. Eventually one of them will store a number that another one rejects, and the mismatch will be hard to trace.

Write the order down in your team's notes, along with the name of the function that does it. A new team member who edits the form should know that the cleaning happens in one place, and that changing it means checking the other steps too.

What to test before launch

Run a short test set before you go live. Each test should have an expected result written down before you run it, so you can tell a real pass from a result you simply accepted.

  • Submit the same number in three formats and confirm that one stored value results.
  • Submit a number with no country code and confirm that the form stops it and asks for one.
  • Send a message to a test phone, confirm that it arrives, and check that the final status appears on the contact record.
  • Opt out from the test phone, send again, and confirm that your system blocks the send before it reaches the provider. Then confirm that the provider's error, if it still comes back, is logged and sets the flag.
  • Send a burst of test messages and confirm that your sender respects a 429 response and waits for the retry-after time before it tries again.

Keep the test results in a simple log with the date, the test, the expected result, and the actual result. When something changes later, you can run the same set again and compare. Use the signup API error checks when reviewing retry behavior.

Keep the number clean

Today, run the test set on your signup path and record the results. Then review the failure log every week for the first month. The first month will show you which inputs people actually type, which opt-out patterns appear, and which delivery failures repeat. That review is the cheapest way to improve the list you already have.

Common questions

Does an accepted request prove delivery?

No, acceptance alone does not prove delivery. Check the final delivery status before counting a text as received.

What does error 21610 mean?

Twilio uses error 21610 for outgoing messages to a user who has opted out. Treat it as an opt-out failure rather than a reason to retry.

Can a new signup clear an opt-out?

A new signup alone should not clear an opt-out. Require a clear, recorded choice from the person before changing that state.

Sources and check date

Related posts

More posts