Effortlessly Format US Phone Numbers with n8n
detail.loadingPreview
Automate the standardization of US phone numbers with this n8n workflow. It intelligently handles various input formats, ensuring clean and consistent data for all your downstream processes.
About This Workflow
This n8n workflow provides a robust solution for cleaning and formatting US phone numbers. It starts by receiving phone numbers from another workflow, stripping any non-numeric characters to create a clean base. It then intelligently checks the length of the number, distinguishing between numbers that are already in a full 11-digit format (including the country code) and those that are 10 digits. For 10-digit numbers, it automatically prepends the '1' country code. It also includes checks for invalid or incomplete numbers, routing them appropriately. Finally, it formats the validated numbers into common formats like E.164 and national representations, ensuring data uniformity and reliability across your applications.
Key Features
- Automatic US Country Code Addition: Prepends '1' to 10-digit US phone numbers.
- Data Sanitization: Strips all non-numeric characters from input.
- Multi-Format Output: Generates E.164 and national formats.
- Intelligent Validation: Identifies and handles incomplete or invalid numbers.
- Workflow Integration: Designed to be triggered by other n8n workflows.
How To Use
- Trigger: Start by adding the 'When Executed by Another Workflow' node to receive the 'Phone Number' input.
- Clean Input: Connect a 'Set' node to strip all non-numeric characters from the incoming 'Phone Number'.
- Length Check: Use a 'Switch' node to analyze the length of the cleaned phone number. Define rules for 11+ digits ('Full Number'), 10 digits ('Number'), less than 10 digits ('Invalid Number'), and non-numeric inputs ('Not a Number').
- Add Country Code (if needed): For the 'Number' output from the 'Switch' node, add a 'Set' node that prepends '1' to the phone number.
- Conditional Country Code Check: Use an 'If' node to check if the first digit of the number is '1'. If it is, proceed to formatting.
- Final Formatting: Connect a 'Set' node to the 'If' node's 'true' path. In this node, create new fields for the original input, the standardized number (e.g., 'Phone Number (Input)'), the E.164 format, and the national format.
- Handle Invalid/Unmatched: Connect separate paths from the 'Switch' node for 'Invalid Number' and 'Not a Number' to handle these cases appropriately (e.g., log errors, send notifications).
- Execute: Trigger this workflow from another n8n workflow, passing the phone number you wish to format.
Apps Used
Workflow JSON
{
"id": "7f338646-157b-406a-9ff0-8bf640cf3ede",
"name": "Effortlessly Format US Phone Numbers with n8n",
"nodes": 14,
"category": "Operations",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 7f338646-157b...
About the Author
Crypto_Watcher
Web3 Developer
Automated trading bots and blockchain monitoring workflows.
Statistics
Related Workflows
Discover more workflows you might like
Universal CSV to JSON API Converter
Effortlessly transform CSV data into structured JSON with this versatile n8n workflow. Integrate it into any application as a custom API endpoint, supporting various input methods including file uploads and raw text.
Instant WooCommerce Order Notifications via Telegram
When a new order is placed on your WooCommerce store, instantly receive detailed notifications directly to your Telegram chat. Stay on top of your e-commerce operations with real-time alerts, including order specifics and a direct link to view the order.
On-Demand Microsoft SQL Query Execution
This workflow allows you to manually trigger and execute any SQL query against your Microsoft SQL Server database. Perfect for ad-hoc data lookups, administrative tasks, or quick tests, giving you direct control over your database operations.