Lola Validate Phone Numbers icon

Lola Validate Phone Numbers

Lola Phone Number Validation

Overview

The Lola Validate Phone Numbers node validates and analyzes phone numbers using the google-libphonenumber library. It checks if a given phone number is valid, determines its type (e.g., mobile, fixed line), verifies if it belongs to allowed countries, and formats it in various international standards. This node is useful for workflows that require phone number validation before sending SMS, making calls, or storing user contact information.

Practical examples:

  • Ensuring customer phone numbers are valid and of the correct type before adding them to a CRM.
  • Filtering out invalid or unsupported phone numbers from marketing lists.
  • Validating country-specific phone numbers for region-based services.

Properties

Name Meaning
Phone Number Phone number to validate (e.g., +15555555555). Must be in international format; if not, "+" will be prepended automatically.
Validate Number Whether to perform full validation of a phone number for a region using length and prefix information.
Validate Type Whether to validate the type of the phone number (e.g., mobile, fixed line). If enabled, you can specify allowed types.
Allowed Types List of allowed phone number types. Options: Fixed Line, Fixed Line or Mobile, Mobile, Pager, Personal Numbers, Premium Rate, Shared Cost, Toll Free, UAN, Unknown, Voicemail, VoIP. Only shown if "Validate Type" is true.
Validate Country Whether to validate the country of the phone number. If enabled, you can specify allowed countries.
Allowed Countries Comma-separated list of allowed countries (e.g., US,MX,...). Only shown if "Validate Country" is true.

Output

The node outputs two branches:

  • valid: Items where the phone number passed all enabled validations.
  • invalid: Items where the phone number failed any enabled validation.

Each output item contains a lola_validate_phone field in its json property with the following structure:

{
  "isValid": true,
  "phoneType": "MOBILE",
  "country": "US",
  "countryName": "United States",
  "countryDialCode": 1,
  "allowedCountries": ["US", "MX"],
  "pnf164": "+15555555555",
  "pnfNational": "(555) 555-5555",
  "pnfInternational": "+1 555-555-5555",
  "checks": {
    "isValidType": true,
    "isValidCountry": true,
    "isValidNumber": true,
    "isEmpty": false
  }
}
  • isValid: Overall validity of the phone number based on selected checks.
  • phoneType: Detected type of the phone number (e.g., MOBILE, FIXED_LINE).
  • country: ISO country code detected from the phone number.
  • countryName: Full country name.
  • countryDialCode: Country dialing code.
  • allowedCountries: List of allowed countries (if country validation is enabled).
  • pnf164: E.164 formatted phone number.
  • pnfNational: Nationally formatted phone number.
  • pnfInternational: Internationally formatted phone number.
  • checks: Object containing results of individual checks:
    • isValidType: Whether the phone type is allowed.
    • isValidCountry: Whether the country is allowed.
    • isValidNumber: Whether the number is structurally valid.
    • isEmpty: Whether the input was empty.

Dependencies

  • google-libphonenumber: Used for parsing and validating phone numbers.
  • No external API keys required.
  • No special n8n configuration or environment variables needed.

Troubleshooting

Common issues:

  • Empty or missing phone number: The node will mark the number as invalid if the input is empty.
  • Incorrect formatting: If the phone number does not start with "+", it will be automatically added, but incorrect formats may still fail validation.
  • Invalid country codes: If "Validate Country" is enabled and the phone number's country is not in the allowed list, the number will be marked invalid.
  • Unsupported phone type: If "Validate Type" is enabled and the phone type is not in the allowed list, the number will be marked invalid.

Error messages:

  • Parsing errors from google-libphonenumber may occur for malformed numbers, resulting in the number being marked as invalid.
  • Console logs are present for debugging but do not affect workflow execution.

Links and References

Discussion