Phone Number Parser icon

Phone Number Parser

Parse a phone number and return its information

Overview

The Phone Number Parser node parses and analyzes phone numbers, providing detailed information such as country, validity, formatting in various standards, and type (e.g., mobile, landline). This node is useful for workflows that need to validate, standardize, or extract metadata from phone numbers—such as contact management, CRM data cleaning, lead enrichment, or form validation.

Example use cases:

  • Standardizing user-submitted phone numbers before storing them in a database.
  • Validating phone numbers during onboarding or registration processes.
  • Enriching contact records with country and type information for targeted communication.

Properties

Display Name Type Description
Keep Only Set Boolean Whether only the values set on this node should be kept and all others removed.
Default Country Options The default country code to use when parsing the phone number. Required.
Phone Number String The phone number to parse. Required.

Output

Each input item produces an output object with the following json fields:

{
  "country": "string",                // The detected country code (e.g., "US")
  "countryCallingCode": "string",     // The international calling code (e.g., "1" for US)
  "nationalNumber": "string",         // The national part of the phone number
  "formatNational": "string",         // Formatted in national format (e.g., "(555) 555-5555")
  "formatInternational": "string",    // Formatted in international format (e.g., "+1 555 555 5555")
  "formatE164": "string",             // Formatted in E.164 standard (e.g., "+15555555555")
  "formatRFC3966": "string",          // Formatted in RFC3966 URI format (e.g., "tel:+1-555-555-5555")
  "possible": true,                   // Whether the number is possible for the given country
  "valid": true,                      // Whether the number is valid for the given country
  "nonGeographic": false,             // Whether the number is non-geographic
  "type": "string"                    // The type of number (e.g., "MOBILE", "FIXED_LINE", etc.)
}
  • If "Keep Only Set" is disabled, all original input fields are preserved alongside these parsed results.
  • If "Keep Only Set" is enabled, only the above fields are included in the output.

Dependencies

  • External Library: libphonenumber-js (max version)
  • No API keys or credentials required.
  • No special n8n configuration or environment variables needed.

Troubleshooting

Common issues:

  • Invalid or missing phone number: If the "Phone Number" field is empty or not a valid string, the output fields will be empty or default to false/empty strings.
  • Unsupported country code: If the "Default Country" is not supported, parsing may fail and output fields will be empty or default values.
  • Formatting errors: If the phone number does not match expected formats for the selected country, some output fields may be blank or indicate invalidity.

Error messages:

  • The node does not throw explicit error messages for invalid input; instead, it returns empty or default values in the output fields. To resolve, ensure:
    • The "Phone Number" is correctly formatted and present.
    • The "Default Country" is a valid, supported country code.

Links and References

Discussion