Lola Validate Phone Numbers icon

Lola Validate Phone Numbers

Lola Phone Number Validation

Lola Validate Phone Numbers

AI-generated

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 types or countries, and provides formatted versions of the number. This node is useful for workflows that require phone number validation before sending SMS, making calls, or storing user contact information.

Practical examples:

  • Ensuring only valid and permitted phone numbers are added to your CRM.
  • Filtering out non-mobile numbers before sending SMS campaigns.
  • Validating customer phone numbers during onboarding or registration.

Properties

Name Meaning
Phone Number Phone number to validate (e.g., +15555555555).
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 or not.
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 enabled.
Validate Country Whether to validate the country of the phone number or not.
Allowed Countries Comma-separated list of allowed countries (e.g., US,MX,...). Only shown if "Validate Country" is enabled.

Output

The node outputs an object in the json field under the key lola_validate_phone with the following structure:

{
  "lola_validate_phone": {
    "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
    }
  }
}

Field meanings:

  • isValid: Whether the phone number passed all enabled validations.
  • phoneType: The detected type of the phone number (e.g., MOBILE, FIXED_LINE).
  • country: ISO country code of the phone number.
  • countryName: Full country name.
  • countryDialCode: Country calling code.
  • allowedCountries: Array of allowed country codes (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 type matches allowed types.
    • isValidCountry: Whether the country matches allowed countries.
    • isValidNumber: Whether the number is structurally valid.
    • isEmpty: Whether the input was empty.

Output Routing:

  • If the number is valid (isValid: true), the item is sent to the first output ("valid").
  • If invalid, it is sent to the second output ("invalid").

Dependencies

  • External Library: google-libphonenumber
  • n8n Configuration: No special configuration required.
  • No API keys or external services are needed.

Troubleshooting

Common issues:

  • Empty or missing phone number: Results in isValid: false and isEmpty: true.
  • Phone number without "+" sign: The node automatically prepends "+" if missing.
  • Invalid country code or format: May result in isValid: false and error logs.
  • Allowed Types/Countries mismatch: If the phone number's type or country is not in the allowed lists, isValid will be false.

Error messages:

  • Parsing errors from google-libphonenumber may occur for malformed numbers; these are caught and result in isValid: false.
  • If you see unexpected results, ensure the input phone number is in international format or includes the correct country code.

Links and References

Discussion