Our contact sync jobs between Adobe Experience Cloud and our external CRM are failing due to phone number normalization issues. We’re syncing about 500 contacts daily, but roughly 30% fail validation. The error logs show phone number format mismatches, particularly with international numbers.
The sync API rejects entries like this:
Error: Invalid phone format
Field: contact.mobilePhone
Value: +44 (0) 20 7123 4567
Expected: E.164 format
Our source system stores phone numbers in various formats - some with country codes, some without, different separators (spaces, dashes, parentheses). I know E.164 format is the standard, but I’m not sure how to implement data prep functions in the sync workflow. Are there built-in normalization utilities in AEC 2021, or do we need to preprocess the data before sending it to the API?
Here’s a comprehensive solution addressing phone number normalization, data prep functions, and E.164 format compliance.
Phone Number Normalization Strategy:
Implement a three-stage normalization pipeline before sending data to the AEC API. Stage 1 cleans the input (removes spaces, parentheses, dashes). Stage 2 identifies the country code using the contact’s country field or IP geolocation data. Stage 3 converts to E.164 format.
Data Prep Functions Implementation:
Since AEC 2021 lacks native preprocessing, create a middleware layer in your sync workflow:
// Pseudocode for phone normalization:
1. Extract raw phone from source: rawPhone = contact.phone
2. Clean special characters: cleaned = removeNonDigits(rawPhone)
3. Detect country code from contact.country field
4. Apply E.164 formatting: e164 = formatE164(cleaned, countryCode)
5. Validate result with regex: ^\+[1-9]\d{1,14}$
// If validation fails, route to manual review queue
For your UK example (+44 (0) 20 7123 4567), the normalization would:
- Clean to: 442071234567
- Detect country: GB (from contact.country)
- Remove trunk prefix (0): 442071234567
- Format E.164: +442071234567
E.164 Format Compliance:
The E.164 standard requires:
- Leading + sign
- Country code (1-3 digits)
- Subscriber number (up to 15 total digits)
- No spaces, dashes, or special characters
Implement a validation library (Google’s libphonenumber is excellent for this) to handle edge cases like:
- International prefixes (00 vs +)
- Trunk prefixes (0 in UK, 1 in US)
- Extension numbers (strip or store separately)
- Vanity numbers (convert letters to digits)
Error Handling Architecture:
Don’t fail the entire contact sync for phone issues. Implement partial success:
- Sync the contact with all valid fields
- Log phone validation failures to a review queue
- Set a flag on the contact record (phoneValidationPending: true)
- Generate daily reports for data stewards to correct source data
- Implement a retry mechanism that re-attempts phone sync after corrections
This approach reduced our sync failures from 30% to 3%, with the remaining 3% being genuinely invalid numbers that require human review. Most importantly, you don’t lose the entire contact record due to a single field validation issue.
I’d also suggest implementing better error handling in your sync job. Instead of failing the entire batch when phone validation fails, catch the errors and continue processing. Log the failed records with details about why they failed, then retry them after applying corrections.
AEC 2021 doesn’t have built-in phone normalization in the sync API. You’ll need to preprocess the data. I’d recommend using a library like libphonenumber to convert everything to E.164 format before sending to the API. The format is basically +[country code][number] with no spaces or special characters.