Formatter Features: formatting phone numbers

  • 1 September 2021
  • 3 replies
  • 5783 views
Formatter Features: formatting phone numbers
Userlevel 7
Badge +9

Hello everyone! Jesse Parker here, doing a deep-dive into how best use the Formatter utility to format/manipulate phone numbers. Apps that send and receive phone number data often require different number formatting so this can be a useful tool to modify numbers and minimize issues when sending data from one app to another.

This option can be found at:

Formatter by ZapierNumbersFormat Phone Number

TI3tq0wwfBIQyR475n-RIyQxro4Jz3N_6kBqVIkmZ-d2KoGzcCix6p0Uypff3y-KoAUYXc4L6Qq6oitvWVvdHwvu-HOx_XrUv1YiG2Nvf33dgFwGFRmOJjE5bxqC6gBekDNBEwGI=s0

What it Looks Like

BY637yCJq4YeV7HqWLWABRRrd6JLSgduYmh2oer8RQuC4Lu-g_8B8-SJ8t6_7v9YuoyCqTkcdxcVQ3sWlX2_dN2_O-wLGpw6fOkJNXilZdqgmesLvwyVsawFYgpfC3gzht-vopwk=s0

It can...

  • Check to see if a phone number is valid or not

  • Format a phone number based on a list of pre-selected formats including:

    • E164

    • National

    • International

    • RFC3966

    • International, No Country Code

    • International, No Hyphens

    • National, No Parenthesis

    • No Symbols, National

    • No Symbols, International

It can not...

  • Automatically detect the country code of a phone number (workaround)

  • Remove a “+” and/or pre-existing country code from data coming from your trigger step (workaround)

  • Extract a phone number from a block of text (workaround)

  • Lookup a country by country code and vice-versa (workaround)

  • Format numbers when country codes from the trigger step, vary

Getting Started

The first thing we’ll take a look at is understanding each of the fields in your “Format Phone Number” action step.

7Kn1IoU9E4u6xKJ5dVFMSTlL47IjXPofm-45GyJNxrihyvSQLy-JxN-pha4CO1GWmBMWBJ6GNfW8zHFB5DlETfO7_oA0LRyJs10LoGZGZrrc1H_kwVcf5epz5IFgLBzwg5mOESQz=s0

  • Input: The phone number that comes from the app you’ve selected in your trigger (Step 1)

  • To Format: A drop-down field that asks what formatting you’d like the phone number to be in. 

  • Phone Number Country Code: This is the  2-letter ISO country code of the phone number you are wanting to format. If you do not see your country listed, you can select "Use a Custom Value (advanced)" and enter an ISO country code (list of 2-letter ISO country codes here). Alternatively, if the ISO country code is included in the data coming from your trigger step, you can dynamically select it here by also using the “custom value” option. 

  • Validate Phone Number: This field is set to “Yes” by default. This means that the Zap will check if the phone number is valid for the country code selected (the United States is the default). 

Configure the Action Step

Select a phone number from the data returned in your trigger step, in the “Input” field.

a8UXzKdJvVAnH0-TEclQolsUqho3hMwOJuyshw3hHJbfaArlIoloRqMbqMjM8rbKrD3QgZx0lDhlEokKeiyBbkjr8lCHFrx7OMCEJfFIoVJxoHUDWHrsqenkVj2a6OIMT3gCjlxT=s0

Select the format you’d like to transform the phone number into, in the “To Format” drop-down field.

yC8NuXo8EAskQg77sp5RDh28aeOtCaiHQdNoiG4fECpuj5__1sbwCcL-iseg2TkL4qOkF1Rf00xZ0STeO3RGHpfcJ2P36lT7AXjQEWuR8ARhjjwUPASv679k9ompa-W-8LrThkuM=s0

Next, select the Country Code of the phone number and if you’d like for the Zap to validate the number.

qUngM4MBb1nsWvd_LOfrGbJf9ddI0jFzoinSYgznUlD_EGI-oH9t9wkV80he--hlQc0QvQC_6iZUPV1ECGvE9X3hTKJkd-Og6HdVrjvwVkxYKOz_1L6O-ixy5hsXPzhQpf6F2BTZ=s0

Lastly, test your action to make sure the phone number is formatted in the way you expected.

e5TPO-VJed0lIT4YFDuPvTmaZSbGxXCbSm7rhz_G-RqHh6cuCBhQxx-4abeZegns38pSS0t8aav3wEO-1qqyDunvUg7HrVxf-pLh-XvMec65NOF1s2OEgSUnoqDtbmqH6sVYp8p2=s0

Tricky Things to Note

Fake phone numbers (e.g. there is no 555 area code in the United States), phone numbers with too many or not enough numbers, or phone numbers with invalid characters will not be transformed if the “Validate Phone Number” field is set to “Yes”, even if everything else is set up correctly.

Other Resources

Using Extract Pattern to get phone numbers, emails and other types of text from a field.

Coming up in the Series

Next up in the Formatter Features series we'll be taking a look at extracting emails and URLs using Formatter. Until next time!


3 replies

Can the hyperlinks in this article please be updated. Many don’t work.

Userlevel 7
Badge +9

@jamesforpm sure thing! To confirm, is it only these 2 bullets that need updated links, or are there others?

  • Extract a phone number from a block of text (workaround)

  • Lookup a country by country code and vice-versa (workaround)

Let me know!

I am a bit baffled here - 

The phone number formatter is extremely flawed

The phone number formatter only “formats” if the “validate” option is turned on. Otherwise, it just spits out what was input (thus wasting a task for the sake of wasting a task). 

More importantly,  the “validate” option triggers formatting ONLY IF the number can be formatted for the country selected. If the number can’t be formatted or is “invalid” it simply outputs the unformatted number. So either way you get a single output field with a number (either formatted or not) and no indication if it is “valid”. 

This means that there is no actual indication to the next step if the number is valid or not - so this is NOT a validator it is half broken number formatter that is poorly worded and implemented.  Please don’t suggest tacking on another set of formatter or pattern match steps to add further logic (to suck more tasks) when the formatter tool should at least output the number and a field indicating validation status so that it can be acted upon accordingly.

 

The same with the “error handler”…. the errored step clearly returned an error, but you don’t make the error available in the “error” branch so that it can be acted upon logically based on the actual returned error.

 

Reply