Phone Formatter Task¶
Overview¶
The Phone Formatter Task standardizes phone numbers into consistent formats. Use it to clean data, ensure E.164 compliance for SMS/calling systems, display formatted numbers, or validate phone inputs.
When to use this task:
- Standardize phone numbers from form submissions
- Format for SMS sending (E.164)
- Display user-friendly formats
- Validate phone number format
- Clean imported data
- Convert between international formats
- Remove invalid characters
Key Features:
- Multiple format outputs
- International country code support
- Automatic country detection
- Remove special characters
- E.164 compliance for APIs
- Display formats for UI
- Validation and error handling
Quick Start¶
- Add Phone Formatter task
- Input phone number field
- Select country (or auto-detect)
- Choose output format
- Save
Simple Example:
Configuration¶
Input Phone Number¶
From form:
From contact:
From database:
Country Selection¶
Fixed country:
Dynamic country:
Auto-detect:
(Detects from number format or defaults to account settings)Default Country¶
If phone has no country code and auto-detect fails:
Output Formats¶
The Phone Formatter provides multiple formatted versions:
| Field | Format | Example | Use Case |
|---|---|---|---|
task_24001_e164 | +[country][number] | +15551234567 | SMS/calling APIs |
task_24001_international | +[country] [formatted] | +1 555-123-4567 | Display |
task_24001_national | [formatted without country] | (555) 123-4567 | Local display |
task_24001_rfc3966 | tel:+[country][number] | tel:+15551234567 | Click-to-call links |
task_24001_digits_only | [numbers only] | 5551234567 | Storage/comparison |
task_24001_country_code | [country code] | US | Metadata |
task_24001_is_valid | true/false | true | Validation |
Common Patterns¶
Format for SMS¶
Display Formatted¶
Show on website: {{task_24001_international}}
Result: +1 555-123-4567
Show locally: {{task_24001_national}}
Result: (555) 123-4567
Click-to-Call Link¶
Validate Phone¶
If {{task_24001_is_valid}} = true:
→ Continue workflow
If {{task_24001_is_valid}} = false:
→ Send error notification
Clean for Storage¶
Always use E.164 for database storage (consistent, searchable).Real-World Examples¶
Example 1: Form Submission Cleanup¶
Workflow: 1. Website Form 2. Phone Formatter - Clean phone 3. If Task - Validate 4. Match to Client - Find/update contact
Phone Formatter:
Validation:
Match to Client:
Example 2: SMS Campaign with International Numbers¶
Workflow: 1. MySQL Query - Get contacts 2. Loop - Process each 3. Phone Formatter - Format for SMS 4. If Task - Check valid 5. SMS Task - Send message
Phone Formatter:
Validation:
Example 3: Display Formatting¶
Workflow: 1. CRM Trigger - Contact viewed 2. Phone Formatter - Format phones 3. Webhook Out - Send to display
Format multiple phones:
Phone 1: {{task_47001_phone}}
→ Display: {{task_24001_international}}
Phone 2: {{task_47001_mobile}}
→ Display: {{task_24002_international}}
Webhook body:
{
"contact_id": "{{task_47001_contact_id}}",
"phones": {
"office": "{{task_24001_international}}",
"mobile": "{{task_24002_international}}"
}
}
Country-Specific Formats¶
United States (US)¶
Input variations: - 555-123-4567 - (555) 123-4567 - 5551234567 - +1 555-123-4567
Outputs: - E.164: +15551234567 - National: (555) 123-4567 - International: +1 555-123-4567
United Kingdom (GB)¶
Input variations: - 020 7123 4567 - +44 20 7123 4567 - 02071234567
Outputs: - E.164: +442071234567 - National: 020 7123 4567 - International: +44 20 7123 4567
South Africa (ZA)¶
Input variations: - 011 123 4567 - +27 11 123 4567 - 0111234567
Outputs: - E.164: +27111234567 - National: 011 123 4567 - International: +27 11 123 4567
Australia (AU)¶
Input variations: - (02) 1234 5678 - +61 2 1234 5678 - 0212345678
Outputs: - E.164: +61212345678 - National: (02) 1234 5678 - International: +61 2 1234 5678
Best Practices¶
Always Validate¶
Store E.164¶
Always save {{task_24001_e164}} to database: - Consistent format - Searchable - SMS/API compatible
Display International¶
Show {{task_24001_international}} to users: - Clear country code - User-friendly format - Click-to-call compatible
Handle Missing Country¶
If {{task_49001_country}} empty, uses US as fallback.
Clean Before Format¶
Remove known invalid characters:
// In Code task before Phone Formatter
let phone = input.task_49001_phone || '';
phone = phone.replace(/[^0-9+]/g, ''); // Keep only digits and +
return { cleaned_phone: phone };
Then format: {{task_42001_cleaned_phone}}
Troubleshooting¶
Phone Shows as Invalid¶
Check: 1. Country code correct? 2. Number has enough digits? 3. Number format matches country?
Common issues: - Missing country code when needed - Extra digits - Wrong country selected
Debug:
E.164 Format Wrong¶
Issue: {{task_24001_e164}} = 15551234567 (missing +)
Cause: Using digits_only instead of e164
Solution: Always use {{task_24001_e164}} for API calls.
Country Not Detected¶
Issue: Auto-detect fails
Solution: Set default country:
International Format Not Showing¶
Issue: Shows national format
Cause: Input didn't include country code
Solution: 1. Specify country in task 2. Or include + in input: +1 555-123-4567
Frequently Asked Questions¶
What's E.164 format?¶
International standard: +[country code][number] - No spaces, dashes, parentheses - Starts with + - Example: +15551234567
Why store E.164 format?¶
- Consistent across all countries
- Required for SMS/calling APIs
- Easier to search/match
- Prevents duplicates
Can it validate mobile vs landline?¶
No, it validates format only. Use carrier lookup service for mobile detection.
What if country is unknown?¶
Set default country in task configuration. Most common: US, GB, ZA.
Can I format multiple phones in one task?¶
No, use separate Phone Formatter task for each number:
Does it work with extensions?¶
No, extensions should be stored separately:
How do I handle toll-free numbers?¶
Format normally. Examples: - US: +18001234567 - GB: +448001234567
Related Tasks¶
- SMS Task - Send to
{{task_24001_e164}} - Match to Client - Match by formatted phone
- Edit Client - Update with clean format
- If Task - Validate before proceeding
- Code Task - Additional phone processing