This commit is contained in:
Lizandro Guarnizo
2026-02-03 21:30:55 -05:00
parent 44423adb32
commit 1aae148396
89 changed files with 8581 additions and 7687 deletions
+10 -3
View File
@@ -163,10 +163,17 @@ try {
echo json_encode(['error' => 'Mensaje requerido']);
exit;
}
// Procesar saltos de línea escapados (\\n o \n) -> convertir a saltos reales
$message = $input['message'];
$message = str_replace('\\n', "\n", $message); // \n escapado literal
$message = preg_replace('/(?<!\\\\)\\\\n/', "\n", $message); // \n en string
// DEBUG: Mostrar datos de envío de mensaje de texto
error_log("=== DEBUG WHATSAPP TEXT MESSAGE ===");
error_log("Recipient: " . $recipient);
error_log("Message: " . $input['message']);
error_log("Message original: " . $input['message']);
error_log("Message processed: " . $message);
error_log("Method: sendTextMessage()/sendTextReply()");
error_log("====================================");
@@ -175,9 +182,9 @@ try {
if (!empty($input['reply_to'])) {
$replyTo = $input['reply_to'];
$response = $whatsappService->sendTextReply($recipient, $replyTo, $input['message'], $operatorId ? ['operator_id' => $operatorId] : null);
$response = $whatsappService->sendTextReply($recipient, $replyTo, $message, $operatorId ? ['operator_id' => $operatorId] : null);
} else {
$response = $whatsappService->sendTextMessage($recipient, $input['message'], $operatorId ? ['operator_id' => $operatorId] : null);
$response = $whatsappService->sendTextMessage($recipient, $message, $operatorId ? ['operator_id' => $operatorId] : null);
}
break;