up
This commit is contained in:
+10
-3
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user