up
up
This commit is contained in:
@@ -172,6 +172,7 @@ try {
|
||||
}
|
||||
$language = $input['language'] ?? 'es';
|
||||
$parameters = $input['parameters'] ?? [];
|
||||
$componentsSimple = $input['components'] ?? null;
|
||||
|
||||
// Verificar plantilla en base de datos (opcional)
|
||||
$templateRecord = null;
|
||||
@@ -185,7 +186,7 @@ try {
|
||||
// Si no existe la tabla, continuar sin validación local
|
||||
error_log("Template validation skipped: " . $e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
// Solo validar si la tabla existe y encontramos registros
|
||||
if ($templateRecord && $templateRecord['status'] !== 'approved') {
|
||||
echo json_encode([
|
||||
@@ -219,7 +220,7 @@ try {
|
||||
|
||||
// Intentar envío y, si falla por traducción no encontrada, probar variantes de idioma
|
||||
try {
|
||||
$response = $whatsappService->sendTemplateMessage($recipient, $template, $language, $parameters);
|
||||
$response = $whatsappService->sendTemplateMessage($recipient, $template, $language, $parameters, [], $componentsSimple);
|
||||
} catch (Exception $e) {
|
||||
$message = $e->getMessage();
|
||||
|
||||
@@ -295,6 +296,9 @@ try {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Preserve raw components (flow/buttons/header/image) and pass through
|
||||
$componentsArray = $templateData['components'] ?? null;
|
||||
|
||||
// DEBUG: Mostrar datos de envío de plantilla formato WhatsApp estándar
|
||||
error_log("=== DEBUG WHATSAPP TEMPLATE MESSAGE (WHATSAPP STANDARD FORMAT) ===");
|
||||
@@ -307,7 +311,7 @@ try {
|
||||
error_log("Method: sendTemplateMessage()");
|
||||
error_log("=================================================================");
|
||||
|
||||
$response = $whatsappService->sendTemplateMessage($recipient, $templateName, $languageCode, $parameters);
|
||||
$response = $whatsappService->sendTemplateMessage($recipient, $templateName, $languageCode, $parameters, [], $componentsArray);
|
||||
}
|
||||
else {
|
||||
http_response_code(400);
|
||||
|
||||
Reference in New Issue
Block a user