This commit is contained in:
lizandrogd
2026-01-21 08:28:54 -05:00
parent 7d6c3b4fb4
commit 45a11032f5
59 changed files with 315 additions and 315 deletions
+4 -4
View File
@@ -233,7 +233,7 @@ class WhatsAppService
'message_id' => $messageId
];
$url = $this->apiUrl . $this->phoneNumberId . '/messages';
$url = $this->apiUrl . $this->phoneNumberId . '/conversations';
return $this->makeRequest('POST', $url, $data);
}
@@ -400,7 +400,7 @@ class WhatsAppService
private function sendMessage($data)
{
// Construir URL correctamente
$url = rtrim($this->apiUrl, '/') . '/' . $this->phoneNumberId . '/messages';
$url = rtrim($this->apiUrl, '/') . '/' . $this->phoneNumberId . '/conversations';
// Debug log
error_log("WhatsApp API URL: " . $url);
@@ -410,7 +410,7 @@ class WhatsAppService
$response = $this->makeRequest('POST', $url, $data);
// Guardar mensaje enviado en la base de datos
if ($response && isset($response['messages'][0]['id'])) {
if ($response && isset($response['conversations'][0]['id'])) {
$this->saveOutgoingMessage($data, $response);
}
@@ -506,7 +506,7 @@ class WhatsAppService
if ($user) {
$messageData = [
'user_id' => $user['id'],
'message_id' => $response['messages'][0]['id'],
'message_id' => $response['conversations'][0]['id'],
'direction' => 'outgoing',
'message_type' => $data['type'],
'content' => $this->extractMessageContent($data),