Is it common to have the phone number
✅ (SOLVED) Is it common to have the phone number provided as invalid?
Is there any rule to pass a "valid" phone number?

14 Replies
Hey @Pedro Talaia could you please share the request format ?
this should be following
Sorry but where can I check this?
I can't check this on the workflow run right? It's on the Docker Container run ?
{
"page": "https://apbizz.com/contact/",
"email": "example@gmail.com",
"phone": "88191388412",
"source": "https://apbizz.com",
"company": "google",
"message": "",
"service": [
"ABIZZ"
],
"full_name": "John Doe",
"timestamp": 1760095308
},
C. Dias
A+Bizz
Contact - A+Bizz
Contact us for a free diagnostic of your business Schedule a complimentary video call with our team. We'll conduct a pre-diagnostic of your company and provide a tailored budget proposal based on your specific needs. Frequently Asked Questions About Our Company Product & Technology Pricing & Purchasing
I have a function to run to "check" the phone number:
export const main = async (params: {
phone: string;
full_name: string;
timestamp: number;
}): Promise<object> => {
const { full_name, phone, timestamp } = params;
// ---- Name split ----
const parts = (full_name "").trim().split(/\s+/);
const firstName = parts[0] "";
const lastName = parts.length > 1 ? parts.slice(1).join(" ") : "";
// ---- Phone normalize + country code ----
// remove spaces; convert leading '00' to '+'; keep only + and digits
const normalized = (phone "")
.trim()
.replace(/\s+/g, "")
.replace(/^00/, "+")
.replace(/(?!^+)\D/g, ""); // strip non-digits except leading '+'
const ccMatch = normalized.match(/^+?(\d{1,4})/);
const countryCode = ccMatch ? ccMatch[1] : "";
// ---- Format timestamp -> "MM/DD/YYYY HH:mm" (local time) ----
const dateObj = new Date((timestamp 0) * 1000);
if (isNaN(dateObj.getTime())) {
return { error: "Invalid timestamp" };
}
const mm = String(dateObj.getMonth() + 1).padStart(2, "0");
const dd = String(dateObj.getDate()).padStart(2, "0");
const yyyy = dateObj.getFullYear();
const hh = String(dateObj.getHours()).padStart(2, "0");
const min = String(dateObj.getMinutes()).padStart(2, "0");
const date =
${mm}/${dd}/${yyyy} ${hh}:${min};
return {
firstName,
lastName,
phone: normalized,
countryCode,
date
};
};
And to return as a string as well
@Prastoin any ideas about this ?Again the same

@thomast would you be able to help me with this one ?
The phone is a "string" as requested right on the request format that prastoin shared

did you set the country code? May I see the Node tab of your step so I can try to reproduce?
No, I didn't setup the country code
Yes OMW
export const main = async (params: {
phone: string;
full_name: string;
timestamp: number;
}): Promise<object> => {
const { full_name, phone, timestamp } = params;
// ---- Name split ----
const parts = (full_name "").trim().split(/\s+/);
const firstName = parts[0] "";
const lastName = parts.length > 1 ? parts.slice(1).join(" ") : "";
// ---- Phone normalize + country code ----
// remove spaces; convert leading '00' to '+'; keep only + and digits
const normalized = (phone "")
.trim()
.replace(/\s+/g, "")
.replace(/^00/, "+")
.replace(/(?!^+)\D/g, ""); // strip non-digits except leading '+'
const ccMatch = normalized.match(/^+?(\d{1,4})/);
const countryCode = ccMatch ? ccMatch[1] : "";
// ---- Format timestamp -> "MM/DD/YYYY HH:mm" (local time) ----
const dateObj = new Date((timestamp 0) * 1000);
if (isNaN(dateObj.getTime())) {
return { error: "Invalid timestamp" };
}
const mm = String(dateObj.getMonth() + 1).padStart(2, "0");
const dd = String(dateObj.getDate()).padStart(2, "0");
const yyyy = dateObj.getFullYear();
const hh = String(dateObj.getHours()).padStart(2, "0");
const min = String(dateObj.getMinutes()).padStart(2, "0");
const date =
${mm}/${dd}/${yyyy} ${hh}:${min};
return {
firstName,
lastName,
phone: normalized,
countryCode,
date
};
};

I added "no country"

Perhaps it's because of that?
yep this is the missing country code the issue
Thanks @thomast I will pass a default value and then adapt when we can add dynamically