DA4: Data in motion

Lesson 5 of 5 · reading 15–25 minutes; practice and project time is on the module page

Cleaning phone numbers and names

🎯You'll be able to

Normalise Indian phone numbers to E.164 and tidy names, and flag values that can't be fixed safely.

🏠The everyday picture

The same friend can be saved in your phone as "Rahul", "Rahul K" and "rahul kumar office", with three different number formats. When you want to message him, you're not sure which entry is right.

📘What it really is

📝A worked example

Twenty Sharma Textiles contacts were cleaned:

Original Cleaned Result
98765 43210 +919876543210 Valid
09876543210 +919876543210 Valid; matches the contact above, so a duplicate
+91-98765-4321 — Only 9 digits after +91: sent to review
asha VERMA Asha Verma Spaces and capitals tidied
K. Lakshmi K. Lakshmi Left as written

Cleaning showed two records were the same customer, which the weekly CRM tidy-up project will merge.

🌍Where it's used

📝Case scenario

A WhatsApp campaign fails for a third of contacts. The numbers were stored as 09876543210, with a leading zero and no country code, which the messaging API rejects. You add a cleaning step at the point where contacts enter the CRM, clean the existing records in a one-off run with a report of changes, and send invalid numbers to staff to check.

🖱️Try it

Write 20 messy phone numbers and names (include valid, invalid and duplicate ones). Apply the cleaning rule by hand, then in an n8n step (an expression or Code node; you'll write more code in DA5). Count how many were valid, invalid and duplicates.

⚠️Common mistakes

🛠️For your project

Make the starter tidyup/clean-phone.js pass all 13 of its tests. Project 3 uses it on 412 contacts.

✅Quick check

What is the E.164 form of the Indian mobile number 09876543210?

Show the answer

+919876543210.

Why keep the original value when cleaning data?

Show the answer

So you can trace and fix mistakes if the cleaning rule turns out to be wrong.

← PreviousMoney in paise and rupees
ProLearners Assist