Using Zapier to Process Phone Number Format
This guide shows you how to normalize phone numbers from various formats (like ClickFunnels) into the international format required by ABC Sales AI.
Step-by-Step Setup
1. In Zapier
Add a new Action → Code by Zapier → Run Javascript.
2. In "Input Data"
Add a field called \phone\ and map it to your ClickFunnels phone output.
3. Paste the Code Below
\\\`javascript
// normalize
const raw = (inputData.phone || "").trim();
const digits = raw.replace(/\\D/g, "");
// if they already passed +60, 60, +65, 65, +673 or 673 → just ensure it has "+"
if (/^(\\+?60|60|(\\+?65)|65|(\\+?673)|673)/.test(digits)) {
// if they didn't include "+", add it
return {
formattedPhone: raw.startsWith("+")
? raw
: "+" + digits
};
}
// Malaysian mobiles all start "01…"
if (digits.startsWith("01")) {
return { formattedPhone: "+6" + digits };
}
// Singapore mobiles start "8…" or "9…" (8 digits long)
if (/^[89]/.test(digits)) {
return { formattedPhone: "+65" + digits };
}
// Brunei local numbers are 7 digits long
if (digits.length === 7) {
return { formattedPhone: "+673" + digits };
}
// Fallback-pass it through untouched
return { formattedPhone: raw };
\\\`
4. In Your Next Webhook Step
Send the \formattedPhone\ field instead of the raw phone.
Supported Formats
- 0123456789 (MY mobile) → +60123456789
- 60123456789 → +60123456789
- +60123456789 → +60123456789
- 81234567 (SG mobile) → +6581234567
- 91234567 (SG mobile) → +6591234567
- 1234567 (7 digits, Brunei) → +6731234567