Parse Phone Number

Note: 

  • Each time the Parse Phone Number task is executed, it triggers an API request to the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
  • Only actual executions that receive a response are counted, not the number of times the task appears in the script. For 
    example, if Parse Phone Number task is placed inside a for each task that iterates five times, the number of external API calls consumed will be five, even though the task appears only once in the script.

Description

The zoho.ai.parsePhoneNumber task examines the given phone number to provide its device, network, location, and formatting information.

Note: 

  • The prediction results may not be accurate, which is also the case with any AI prediction. However, we are working on improving this.
  • The prediction results are dynamic. The same script may produce different outcomes at different times based on how much the machine has learned.

Syntax

<response> = zoho.ai.parsePhoneNumber(<phone_number>, <country_code>);

where:

ParamsData typeDescription
<response>KEY-VALUESpecifies the time zone, location, type of the device, network provider, and formatting information of the given phone number.
<phone_number>TEXT

Specifies the phone number that needs to be examined.

Note: The specified number should not have space separations regardless of the relevant country's phone number format.

<country_code>TEXTSpecifies the country code of the phone number in ISO alpha-2 format.
Note: You can find the list of ISO alpha-2 country codes here.

Example

The following script provides information about the phone number - 92597XXXXX.

response = zoho.ai.parsePhoneNumber("92597XXXXX","US");

where:

response
The KEY-VALUE response that represents the time zone, location, type of the device, network provider, and formatting information of the given phone number.
"92597XXXXX"
The TEXT that represents the phone number that needs to be parsed.
"US"
The TEXT that represents the ISO Alpha-2 country code of the phone number.

Response Format

Success Response

  • The success response will be returned in the following format:

     {
     "extension":"",
     "italian_leading_zero":"false",
     "international_format":"+1 925-97X-XXXX",
     "national_format":"(925) 97X-XXXX",
     "timezone":"[\"America/Los_Angeles\"]",
     "e164_format":"+192597XXXXX",
     "national_number":"92597XXXXX",
     "type":"FIXED_LINE_OR_MOBILE",
     "outside_from_CH":"00 1 925-97X-XXXX",
     "country_code":"1",
     "carrier":"",
     "original_format":"(925) 97X-XXXX",
     "outside_from_US":"1 (925) 97X-XXXX",
     "location":"California",
     "raw_input":"92597XXXXX",
     "region":"US",
     "country_code_source":"FROM_DEFAULT_COUNTRY"
     }

To fetch the the parsed values from the response, use get() function. For example, the following script fetches the timezone from the returned response:

 info response.get("timezone");

Failure Response

  • The failure response for an empty input text will be returned in the following format:

     {
     "Error Message ": "phoneNumber less than minimum occurrence"
     }
  • The failure response for invalid phone number pattern will be returned in the following format:

     {
     "Error Message":"phoneNumber value is not in the expected pattern"
     }
  • The failure response for invalid country code will be returned in the following format:

     {
     "Error Message":"countryName value is not in the expected pattern"
     }

 

Related Links