up
This commit is contained in:
@@ -133,7 +133,17 @@ try {
|
||||
}
|
||||
|
||||
// Guardar respuesta en base de datos
|
||||
if ($response && isset($response['conversations'][0]['id'])) {
|
||||
// Aceptar tanto respuestas con 'conversations' como con 'messages'
|
||||
$sentMessageId = null;
|
||||
if ($response) {
|
||||
if (isset($response['conversations'][0]['id'])) {
|
||||
$sentMessageId = $response['conversations'][0]['id'];
|
||||
} elseif (isset($response['messages'][0]['id'])) {
|
||||
$sentMessageId = $response['messages'][0]['id'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($response && $sentMessageId) {
|
||||
error_log("send_media_message.php - Respuesta de WhatsApp exitosa: " . json_encode($response));
|
||||
|
||||
// Guardar en base de datos
|
||||
@@ -149,7 +159,7 @@ try {
|
||||
// Datos base para insertar
|
||||
$conversationData = [
|
||||
'user_id' => $user['id'],
|
||||
'message_id' => $response['conversations'][0]['id'],
|
||||
'message_id' => $sentMessageId,
|
||||
'direction' => 'outgoing',
|
||||
'message_type' => $mediaType,
|
||||
'content' => $caption ?? $filename ?? '',
|
||||
|
||||
Reference in New Issue
Block a user