fix(notifications): dirigir todas las notificaciones de DripZone exclusivamente al WhatsApp personal de Carlos
This commit is contained in:
parent
6cebc76599
commit
8d4ba3ee88
@ -114,7 +114,6 @@ ${customerEmail ? `✉️ *Correo:* ${customerEmail}\n` : ''}
|
||||
⚡ ¡Consulta de inmediato con tus proveedores mayoristas para enviar cotización al cliente!`;
|
||||
|
||||
sendWhatsAppMessage(CARLOS_PHONE, adminMessage).catch(() => {});
|
||||
sendWhatsAppMessage('120363428012905103@g.us', adminMessage).catch(() => {});
|
||||
|
||||
// 2. Confirmación automática al cliente por WhatsApp usando la plantilla registrada
|
||||
const settings = dataService.getSettings();
|
||||
|
||||
@ -127,8 +127,7 @@ export async function sendWhatsAppMedia(
|
||||
|
||||
/**
|
||||
* Notifica inmediatamente la publicación automática de un nuevo producto
|
||||
* tanto al WhatsApp personal de Carlos (+57 316 745 5877) como al canal
|
||||
* de Notificaciones Almeira (120363428012905103@g.us).
|
||||
* exclusivamente al WhatsApp personal de Carlos (+57 316 745 5877).
|
||||
*/
|
||||
export async function notifyNewProductPublished(
|
||||
product: any,
|
||||
@ -136,8 +135,7 @@ export async function notifyNewProductPublished(
|
||||
mediaUrl?: string
|
||||
): Promise<{ success: boolean; dispatchedTo: string[] }> {
|
||||
const NOTIFICATION_TARGETS = [
|
||||
'573167455877', // Carlos (WhatsApp personal)
|
||||
'120363428012905103@g.us', // Notificaciones Almeira
|
||||
'573167455877', // Carlos (WhatsApp personal exclusivo)
|
||||
];
|
||||
|
||||
const retailPrice = product.retailPrice || 125000;
|
||||
@ -273,7 +271,6 @@ export function buildOrderConfirmationMessage(order: any): string {
|
||||
*/
|
||||
export async function notifyAdminNewOrder(order: any): Promise<boolean> {
|
||||
const CARLOS_PHONE = '573167455877';
|
||||
const NOTIFICATION_GROUP = '120363428012905103@g.us';
|
||||
|
||||
const itemsSummary = (order.items || [])
|
||||
.map((item: any) => `• 👟 *${item.productName || item.name}*\n 📏 Talla: *${item.size || 'Única'}* | Cantidad: *${item.quantity || 1}* | Valor: *${formatCOP((item.price || item.retailPrice || 0) * (item.quantity || 1))}*`)
|
||||
@ -326,7 +323,7 @@ export async function notifyAdminNewOrder(order: any): Promise<boolean> {
|
||||
|
||||
let success = false;
|
||||
try {
|
||||
// 1. Notificación principal al WhatsApp personal de Carlos CON LA FOTO DEL PRODUCTO
|
||||
// Notificación exclusiva al WhatsApp personal de Carlos CON LA FOTO DEL PRODUCTO
|
||||
let sentCarlos = false;
|
||||
if (resolvedImageUrl) {
|
||||
sentCarlos = await sendWhatsAppMedia(CARLOS_PHONE, resolvedImageUrl, adminMessage);
|
||||
@ -335,15 +332,6 @@ export async function notifyAdminNewOrder(order: any): Promise<boolean> {
|
||||
sentCarlos = await sendWhatsAppMessage(CARLOS_PHONE, adminMessage);
|
||||
}
|
||||
if (sentCarlos) success = true;
|
||||
|
||||
// 2. Notificación al canal de alertas (grupo) CON LA FOTO DEL PRODUCTO
|
||||
let sentGroup = false;
|
||||
if (resolvedImageUrl) {
|
||||
sentGroup = await sendWhatsAppMedia(NOTIFICATION_GROUP, resolvedImageUrl, adminMessage).catch(() => false);
|
||||
}
|
||||
if (!sentGroup) {
|
||||
await sendWhatsAppMessage(NOTIFICATION_GROUP, adminMessage).catch(() => {});
|
||||
}
|
||||
} catch (err: any) {
|
||||
console.error('Error enviando notificación de pedido a Carlos:', err.message);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user