Actualizar server.js
This commit is contained in:
@@ -645,9 +645,9 @@ async function triggerHomeServeRobot(ownerId, serviceId, eventType) {
|
||||
text = text.replace(/{{FECHA}}/g, raw["scheduled_date"] ? raw["scheduled_date"].split('-').reverse().join('/') : "la fecha acordada");
|
||||
text = text.replace(/{{HORA}}/g, raw["scheduled_time"] || "la hora acordada");
|
||||
|
||||
// 👇 AHORA USA EL EXTRACTOR INTELIGENTE DE TELÉFONOS
|
||||
let phone = raw["Teléfono"] || raw["TELEFONO"] || raw["TELEFONOS"] || "";
|
||||
let cleanPhone = String(phone).replace(/\D/g, "");
|
||||
if (cleanPhone.length > 9) cleanPhone = cleanPhone.slice(-9);
|
||||
let cleanPhone = extractValidPhone(phone);
|
||||
text = text.replace(/{{TELEFONO}}/g, cleanPhone);
|
||||
|
||||
text = text.replace(/{{REFERENCIA}}/g, s.service_ref);
|
||||
|
||||
Reference in New Issue
Block a user