Parse Phone Number
Table of Contents
Description
The zoho.ai.parsePhoneNumber task examines the given phone number to provide its device, network, location, and formatting information.
- 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:
Params | Data type | Description |
<response> | KEY-VALUE | Specifies 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> | TEXT | Specifies the country code of the phone number in ISO alpha-2 format. |
Example
The following script provides information about the phone number - 92597XXXXX.
response = zoho.ai.parsePhoneNumber("92597XXXXX","US");
where:
response
"92597XXXXX"
"US"
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"
}
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"
}