This commit is contained in:
Lizandro Guarnizo
2026-01-21 22:11:12 -05:00
parent 2b92e47624
commit 31dbc8aa86
9 changed files with 158 additions and 4 deletions
+15 -2
View File
@@ -30,7 +30,7 @@ try {
// Obtener información del usuario
$user = $db->fetch(
"SELECT id, phone_number, name FROM users WHERE id = ?",
"SELECT id, phone_number, name, in_service, in_service_by, in_service_at FROM users WHERE id = ?",
[$user_id]
);
@@ -39,6 +39,15 @@ try {
echo json_encode(['error' => 'Usuario no encontrado']);
exit;
}
// Si la conversación está siendo atendida, resolver el nombre del operador
$inServiceByName = null;
if (!empty($user['in_service_by'])) {
$admin = $db->fetch("SELECT id, full_name, username FROM admin_users WHERE id = ?", [$user['in_service_by']]);
if ($admin) {
$inServiceByName = $admin['full_name'] ?: $admin['username'];
}
}
// Obtener todos los mensajes de la conversación
$conversations = $db->fetchAll(
@@ -122,7 +131,11 @@ try {
'user' => [
'id' => intval($user['id']),
'phone_number' => $user['phone_number'],
'name' => $user['name'] ?? $user['phone_number']
'name' => $user['name'] ?? $user['phone_number'],
'in_service' => !empty($user['in_service']) ? true : false,
'in_service_by' => isset($user['in_service_by']) ? intval($user['in_service_by']) : null,
'in_service_at' => $user['in_service_at'] ?? null,
'in_service_by_name' => $inServiceByName
],
'conversations' => $conversations,
'total_conversations' => count($conversations)
+18
View File
@@ -44,3 +44,21 @@
[2026-01-21 14:40:09] Request: GET /api/version/media-url.php?id=3932473397057815 GET:{"id":"3932473397057815"} POST:[]
[2026-01-21 14:40:09] Graph API request to https://graph.facebook.com/v22.0/3932473397057815
[2026-01-21 14:40:10] Proxying Facebook media URL with Authorization to https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=3932473397057815&source=getMedia&ext=1769024699&hash=ARlXiE4qXDbAzqzvCutrIryD_tdYaN1gjuIZWoBHDbilqQ
[2026-01-21 21:35:15] Request: GET /api/version/media-url.php?id=3932473397057815 GET:{"id":"3932473397057815"} POST:[]
[2026-01-21 21:35:15] Graph API request to https://graph.facebook.com/v22.0/3932473397057815
[2026-01-21 21:35:16] Proxying Facebook media URL with Authorization to https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=3932473397057815&source=getMedia&ext=1769049615&hash=ARl0ssx82h2xALShS68EX09cnPLDRp3xDrMkXLHxNpYdmQ
[2026-01-21 21:39:36] Request: GET /api/version/media-url.php?id=3932473397057815 GET:{"id":"3932473397057815"} POST:[]
[2026-01-21 21:39:36] Graph API request to https://graph.facebook.com/v22.0/3932473397057815
[2026-01-21 21:39:37] Proxying Facebook media URL with Authorization to https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=3932473397057815&source=getMedia&ext=1769049877&hash=ARkt4u_w991l5uoAEPQPa_zaMV4_P5fD4HAa6ClILfS5ZA
[2026-01-21 21:55:37] Request: GET /api/version/media-url.php?id=3932473397057815 GET:{"id":"3932473397057815"} POST:[]
[2026-01-21 21:55:37] Graph API request to https://graph.facebook.com/v22.0/3932473397057815
[2026-01-21 21:55:37] Proxying Facebook media URL with Authorization to https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=3932473397057815&source=getMedia&ext=1769050837&hash=ARn_VZzaTBKkCf7WJMaJHiVu3cYe_pxGrq1Ix9YvppbNBA
[2026-01-21 21:59:29] Request: GET /api/version/media-url.php?id=3932473397057815 GET:{"id":"3932473397057815"} POST:[]
[2026-01-21 21:59:29] Graph API request to https://graph.facebook.com/v22.0/3932473397057815
[2026-01-21 21:59:30] Proxying Facebook media URL with Authorization to https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=3932473397057815&source=getMedia&ext=1769051070&hash=ARn9gwkRZ-Tfpv4cSUtMh9pebsJNis-s5tEQeIhxh7iPAA
[2026-01-21 22:00:11] Request: GET /api/version/media-url.php?id=3932473397057815 GET:{"id":"3932473397057815"} POST:[]
[2026-01-21 22:00:11] Graph API request to https://graph.facebook.com/v22.0/3932473397057815
[2026-01-21 22:00:11] Proxying Facebook media URL with Authorization to https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=3932473397057815&source=getMedia&ext=1769051111&hash=ARnFCx7vV54UV2Z2LJnp3JMsxseZMInCxX8bM-xz0mM5AA
[2026-01-21 22:05:03] Request: GET /api/version/media-url.php?id=3932473397057815 GET:{"id":"3932473397057815"} POST:[]
[2026-01-21 22:05:03] Graph API request to https://graph.facebook.com/v22.0/3932473397057815
[2026-01-21 22:05:03] Proxying Facebook media URL with Authorization to https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=3932473397057815&source=getMedia&ext=1769051403&hash=ARm7CptuN3CH6WN5V1RmuW6rK9iIipE_KE1-FLbj3RQuHQ
+8
View File
@@ -2,3 +2,11 @@
[21-Jan-2026 14:31:30 America/Bogota] PHP Warning: preg_match(): Unknown modifier '&' in C:\laragon\www\whatsapp\api\version\media-url.php on line 131
[21-Jan-2026 14:33:32 America/Bogota] PHP Warning: preg_match(): Unknown modifier '&' in C:\laragon\www\whatsapp\api\version\media-url.php on line 131
[21-Jan-2026 14:35:45 America/Bogota] PHP Warning: preg_match(): Unknown modifier '&' in C:\laragon\www\whatsapp\api\version\media-url.php on line 131
[21-Jan-2026 21:35:16 America/Bogota] PHP Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in /Users/lizandro/Documents/GitHub/whatsapp/api/version/media-url.php on line 203
[21-Jan-2026 21:35:17 America/Bogota] PHP Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in /Users/lizandro/Documents/GitHub/whatsapp/api/version/media-url.php on line 522
[21-Jan-2026 21:39:37 America/Bogota] PHP Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in /Users/lizandro/Documents/GitHub/whatsapp/api/version/media-url.php on line 203
[21-Jan-2026 21:39:37 America/Bogota] PHP Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in /Users/lizandro/Documents/GitHub/whatsapp/api/version/media-url.php on line 522
[21-Jan-2026 21:55:37 America/Bogota] PHP Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in /Users/lizandro/Documents/GitHub/whatsapp/api/version/media-url.php on line 203
[21-Jan-2026 21:55:38 America/Bogota] PHP Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in /Users/lizandro/Documents/GitHub/whatsapp/api/version/media-url.php on line 522
[21-Jan-2026 21:59:30 America/Bogota] PHP Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in /Users/lizandro/Documents/GitHub/whatsapp/api/version/media-url.php on line 203
[21-Jan-2026 21:59:30 America/Bogota] PHP Deprecated: Function curl_close() is deprecated since 8.5, as it has no effect since PHP 8.0 in /Users/lizandro/Documents/GitHub/whatsapp/api/version/media-url.php on line 522