up
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
// Test calling API endpoint internally by setting input stream
|
||||
$payload = json_encode([
|
||||
'to' => '573001234567',
|
||||
'message_id' => '<TEST_MSGID>',
|
||||
'emoji' => '👍',
|
||||
'dry_run' => true
|
||||
]);
|
||||
|
||||
file_put_contents('php://memory', $payload); // no effect; instead call service directly
|
||||
|
||||
require_once __DIR__ . '/../api/send_reaction.php';
|
||||
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once __DIR__ . '/../api/send_reply.php';
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
$db = Database::getInstance();
|
||||
try {
|
||||
$col = $db->fetch("SHOW TABLES LIKE 'survey_responses'");
|
||||
if ($col) {
|
||||
echo "Table survey_responses already exists\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = "CREATE TABLE survey_responses (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id INT NULL,
|
||||
phone_number VARCHAR(30) NULL,
|
||||
q_easy_interact TINYINT(1) NULL,
|
||||
q_human_resolved TINYINT(1) NULL,
|
||||
rating INT NULL,
|
||||
comment TEXT NULL,
|
||||
raw_text TEXT NULL,
|
||||
created_at DATETIME NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4";
|
||||
|
||||
$db->query($sql);
|
||||
echo "Created table survey_responses\n";
|
||||
} catch (Exception $e) {
|
||||
echo "Failed creating survey_responses: " . $e->getMessage() . "\n";
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
echo "DB instance ok\n";
|
||||
} catch (Throwable $t) {
|
||||
echo "ERROR: " . $t->getMessage() . "\n";
|
||||
echo $t->getTraceAsString() . "\n";
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
$db = Database::getInstance();
|
||||
$now = date('Y-m-d H:i:s');
|
||||
$id = $db->insert('operator_activity', ['user_id' => 1, 'operator_id' => 1, 'action' => 'test', 'details' => 'test insert', 'created_at' => $now]);
|
||||
var_dump($id);
|
||||
$rows = $db->fetchAll('SELECT * FROM operator_activity ORDER BY created_at DESC LIMIT 5');
|
||||
var_dump($rows);
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Script de prueba: enviar plantilla a un número y mostrar logs
|
||||
* Usage: php send_template_test.php
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../config/config_enhanced.php';
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
require_once __DIR__ . '/../services/WhatsAppService.php';
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
$recipient = '573168950803';
|
||||
$template = 'encuesta_satisfaccin';
|
||||
$initialLang = 'es';
|
||||
$candidates = [$initialLang, 'es_ES', 'es_MX', 'es_PE'];
|
||||
|
||||
echo "=== TEST: Enviar plantilla '$template' a $recipient ===\n";
|
||||
|
||||
try {
|
||||
$wh = new WhatsAppService();
|
||||
echo "WhatsAppService initialized successfully.\n";
|
||||
} catch (Exception $e) {
|
||||
echo "ERROR initializing WhatsAppService: " . $e->getMessage() . "\n";
|
||||
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
foreach ($candidates as $lang) {
|
||||
echo "Intentando con language = $lang ...\n";
|
||||
try {
|
||||
$result = $wh->sendTemplateMessage($recipient, $template, $lang, []);
|
||||
echo "Resultado OK (language=$lang):\n";
|
||||
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "\n";
|
||||
exit(0);
|
||||
} catch (Exception $e) {
|
||||
echo "FALLÓ (language=$lang): " . $e->getMessage() . "\n";
|
||||
// Mostrar detalles si es posible
|
||||
if (isset($e->getTrace()[0]['args'][0])) {
|
||||
echo "Detalle trace arg0: " . var_export($e->getTrace()[0]['args'][0], true) . "\n";
|
||||
}
|
||||
// continuar con siguiente candidato
|
||||
}
|
||||
}
|
||||
|
||||
echo "Todos los intentos fallaron. Revisa WhatsApp Business Manager para esa plantilla y los idiomas disponibles.\n";
|
||||
exit(1);
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config_enhanced.php';
|
||||
$db = Database::getInstance();
|
||||
|
||||
// Get an existing user_id (user of conversations)
|
||||
$user = $db->fetch('SELECT id, phone_number FROM users LIMIT 1');
|
||||
$userId = $user['id'] ?? null;
|
||||
|
||||
$data = [
|
||||
'user_id' => $userId,
|
||||
'type' => 'message',
|
||||
'message' => 'Prueba: nuevo mensaje recibido',
|
||||
'data' => json_encode(['phone' => $user['phone_number'] ?? '']),
|
||||
'is_read' => 0,
|
||||
'created_at' => date('Y-m-d H:i:s')
|
||||
];
|
||||
|
||||
$id = $db->insert('notifications', $data);
|
||||
if ($id) {
|
||||
echo "Inserted notification id=$id for user_id={$userId}\n";
|
||||
} else {
|
||||
echo "Failed to insert notification\n";
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
require_once __DIR__ . '/../services/BotService.php';
|
||||
|
||||
$db = Database::getInstance();
|
||||
$bot = new BotService();
|
||||
|
||||
// Crear usuario de prueba
|
||||
$phone = '573010000123';
|
||||
$db->execute('DELETE FROM users WHERE phone_number = :p', ['p' => $phone]);
|
||||
$userId = $db->insert('users', ['phone_number' => $phone, 'status' => 'active', 'created_at' => date('Y-m-d H:i:s')]);
|
||||
$user = $db->fetch('SELECT * FROM users WHERE id = :id', ['id' => $userId]);
|
||||
|
||||
// Simular comando asesor
|
||||
$bot->processMessage($user, 'asesor', 'text');
|
||||
// Intentar también llamar directamente putOnHold para comprobar
|
||||
$bot->putOnHold($phone);
|
||||
$user2 = $db->fetch('SELECT * FROM users WHERE id = :id', ['id' => $userId]);
|
||||
echo "User after putOnHold: " . json_encode($user2) . "\n";
|
||||
if ($user2['on_hold']) {
|
||||
echo "ON_HOLD set correctly for $phone\n";
|
||||
} else {
|
||||
echo "ON_HOLD NOT SET!\n";
|
||||
}
|
||||
|
||||
// Simular finalizar conversación via menu action (invoke processMenuAction indirectly)
|
||||
// Crear menu option end test: insert temporary menu and option
|
||||
$menuId = $db->insert('menus', ['name'=>'test_menu_end','title'=>'Test End','is_root'=>0,'is_active'=>1,'created_at'=>date('Y-m-d H:i:s')]);
|
||||
$optId = $db->insert('menu_options', ['menu_id'=>$menuId,'option_number'=>9,'text'=>'Terminar','action_type'=>'end','action_value'=>'Gracias, cerrando.','is_active'=>1,'created_at'=>date('Y-m-d H:i:s')]);
|
||||
// Liberar hold y luego establecer menu para probar pause
|
||||
$bot->releaseHold($phone);
|
||||
$db->update('users', ['current_menu_id'=>$menuId], 'id = :id', ['id' => $userId]);
|
||||
|
||||
// Simular selection '9' - recargar usuario para que tenga el current_menu_id
|
||||
$user = $db->fetch('SELECT * FROM users WHERE id = :id', ['id' => $userId]);
|
||||
$bot->processMessage($user, '9', 'text');
|
||||
$user3 = $db->fetch('SELECT * FROM users WHERE id = :id', ['id' => $userId]);
|
||||
if (!empty($user3['bot_paused_until'])) {
|
||||
echo "Bot paused until: {$user3['bot_paused_until']}\n";
|
||||
} else {
|
||||
echo "Bot pause NOT SET!\n";
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
$db->execute('DELETE FROM menu_options WHERE menu_id = :mid', ['mid' => $menuId]);
|
||||
$db->execute('DELETE FROM menus WHERE id = :id', ['id' => $menuId]);
|
||||
$db->execute('DELETE FROM users WHERE id = :id', ['id' => $userId]);
|
||||
|
||||
echo "Done\n";
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
require_once __DIR__ . '/../services/BotService.php';
|
||||
|
||||
$db = Database::getInstance();
|
||||
$phone = '573000000999';
|
||||
// Cleanup
|
||||
$db->execute('DELETE FROM users WHERE phone_number = :p', ['p' => $phone]);
|
||||
$id = $db->insert('users', ['phone_number' => $phone, 'status' => 'active', 'created_at' => date('Y-m-d H:i:s')]);
|
||||
$db->update('users', ['advisor_requested' => 1], 'id = :id', ['id' => $id]);
|
||||
|
||||
$bot = new BotService();
|
||||
$bot->attendConversation($phone, 1);
|
||||
|
||||
$user = $db->fetch('SELECT * FROM users WHERE id = :id', ['id' => $id]);
|
||||
$activity = $db->fetch('SELECT * FROM operator_activity WHERE user_id = :uid ORDER BY created_at DESC LIMIT 1', ['uid' => $id]);
|
||||
|
||||
echo "User in_service: " . ($user['in_service'] ?? 'NULL') . PHP_EOL;
|
||||
echo "in_service_by: " . ($user['in_service_by'] ?? 'NULL') . PHP_EOL;
|
||||
echo "in_service_at: " . ($user['in_service_at'] ?? 'NULL') . PHP_EOL;
|
||||
|
||||
if ($activity) {
|
||||
echo "Activity: action={$activity['action']} operator_id={$activity['operator_id']} details={$activity['details']}\n";
|
||||
} else {
|
||||
echo "No operator activity found\n";
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
require_once __DIR__ . '/../services/BotService.php';
|
||||
$db = Database::getInstance();
|
||||
$bot = new BotService();
|
||||
|
||||
$phone = '573012345678';
|
||||
$db->execute('DELETE FROM users WHERE phone_number = :p', ['p' => $phone]);
|
||||
$userId = $db->insert('users', ['phone_number' => $phone, 'status' => 'active', 'bot_enabled' => 0, 'welcome_sent_at' => date('Y-m-d H:i:s'), 'created_at' => date('Y-m-d H:i:s')]);
|
||||
$user = $db->fetch('SELECT * FROM users WHERE id = :id', ['id' => $userId]);
|
||||
|
||||
// Clear conversations
|
||||
$db->execute('DELETE FROM conversations WHERE user_id = :uid', ['uid' => $userId]);
|
||||
|
||||
// Send message while bot disabled
|
||||
$bot->processMessage($user, 'hola', 'text');
|
||||
$outs = $db->fetchAll("SELECT * FROM conversations WHERE user_id = :uid AND direction = 'outgoing'", ['uid' => $userId]);
|
||||
echo "Outgoing after disabled: " . count($outs) . "\n";
|
||||
|
||||
// Enable bot
|
||||
$db->update('users', ['bot_enabled' => 1], 'id = :id', ['id' => $userId]);
|
||||
$user2 = $db->fetch('SELECT * FROM users WHERE id = :id', ['id' => $userId]);
|
||||
$bot->processMessage($user2, 'hola', 'text');
|
||||
$outs2 = $db->fetchAll("SELECT * FROM conversations WHERE user_id = :uid AND direction = 'outgoing'", ['uid' => $userId]);
|
||||
echo "Outgoing after enabled: " . count($outs2) . "\n";
|
||||
|
||||
// Cleanup
|
||||
$db->execute('DELETE FROM conversations WHERE user_id = :uid', ['uid' => $userId]);
|
||||
$db->execute('DELETE FROM users WHERE id = :id', ['id' => $userId]);
|
||||
|
||||
echo "Done\n";
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
|
||||
// Define a no-op requireAuthentication to bypass auth for test
|
||||
if (!function_exists('requireAuthentication')) {
|
||||
function requireAuthentication() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
session_start();
|
||||
// Mock admin session so requireAuthentication passes
|
||||
$_SESSION['admin_user'] = ['id' => 1, 'username' => 'admin'];
|
||||
|
||||
$db = Database::getInstance();
|
||||
// Clean up any existing test template called 'test_delete_tpl'
|
||||
try { $db->execute('DELETE FROM message_templates WHERE name = ?', ['test_delete_tpl']); } catch (Exception $e) { }
|
||||
// Insert a test template
|
||||
$id = $db->insert('message_templates', [
|
||||
'name' => 'test_delete_tpl',
|
||||
'template_name' => 'test_delete_tpl_name',
|
||||
'language_code' => 'en_US',
|
||||
'category' => 'utility',
|
||||
'status' => 'approved',
|
||||
'created_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
|
||||
echo "Inserted template id: $id\n";
|
||||
|
||||
// Simulate POST body
|
||||
$_POST = ['id' => $id];
|
||||
|
||||
// Capture output
|
||||
ob_start();
|
||||
include __DIR__ . '/../api/delete_template.php';
|
||||
$out = ob_get_clean();
|
||||
|
||||
echo "API Output: $out\n";
|
||||
|
||||
// Verify it was deleted
|
||||
$check = $db->fetch('SELECT * FROM message_templates WHERE id = :id', ['id' => $id]);
|
||||
if (!$check) {
|
||||
echo "Template successfully deleted from DB.\n";
|
||||
} else {
|
||||
echo "Template still exists in DB: " . json_encode($check) . "\n";
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
require_once __DIR__ . '/../services/BotService.php';
|
||||
$db = Database::getInstance();
|
||||
$phone = '573010000010';
|
||||
// ensure user
|
||||
$user = $db->fetch('SELECT * FROM users WHERE phone_number = ?', [$phone]);
|
||||
if (!$user) {
|
||||
$id = $db->insert('users', ['phone_number' => $phone, 'status' => 'active', 'created_at' => date('Y-m-d H:i:s')]);
|
||||
$user = $db->fetch('SELECT * FROM users WHERE id = ?', [$id]);
|
||||
}
|
||||
$bot = new BotService();
|
||||
|
||||
echo "User id: {$user['id']} phone: {$phone}\n";
|
||||
|
||||
// Simulate sending 'INFORMACION ENVIADA' (uppercase + phrase)
|
||||
echo "--- Sending 'INFORMACION ENVIADA' ---\n";
|
||||
$bot->processMessage($user, 'INFORMACION ENVIADA', 'text');
|
||||
// show last conversation entries
|
||||
$rows = $db->fetchAll('SELECT * FROM conversations WHERE user_id = ? ORDER BY created_at DESC LIMIT 5', [$user['id']]);
|
||||
print_r($rows);
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
require_once __DIR__ . '/../services/BotService.php';
|
||||
|
||||
$db = Database::getInstance();
|
||||
$phone = '573000000998';
|
||||
// Cleanup
|
||||
$db->execute('DELETE FROM users WHERE phone_number = :p', ['p' => $phone]);
|
||||
$id = $db->insert('users', ['phone_number' => $phone, 'status' => 'active', 'created_at' => date('Y-m-d H:i:s')]);
|
||||
$db->update('users', ['advisor_requested' => 1], 'id = :id', ['id' => $id]);
|
||||
|
||||
$bot = new BotService();
|
||||
$bot->attendConversation($phone, 1);
|
||||
$user = $db->fetch('SELECT * FROM users WHERE id = :id', ['id' => $id]);
|
||||
echo "After attend: in_service={$user['in_service']} in_service_by={$user['in_service_by']}\n";
|
||||
|
||||
$bot->finishAttendConversation($phone, 1);
|
||||
$user2 = $db->fetch('SELECT * FROM users WHERE id = :id', ['id' => $id]);
|
||||
echo "After finish: in_service={$user2['in_service']} in_service_by={$user2['in_service_by']}\n";
|
||||
$activity = $db->fetch('SELECT * FROM operator_activity WHERE user_id = :uid ORDER BY created_at DESC LIMIT 1', ['uid' => $id]);
|
||||
if ($activity) {
|
||||
echo "Activity: action={$activity['action']} details={$activity['details']}\n";
|
||||
} else {
|
||||
echo "No activity\n";
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
// Test get_conversation_detail.php in debug mode
|
||||
$_GET['debug'] = 'true';
|
||||
$_GET['user_id'] = 2;
|
||||
chdir(__DIR__ . '/../api');
|
||||
ob_start();
|
||||
try {
|
||||
include 'get_conversation_detail.php';
|
||||
} catch (Throwable $t) {
|
||||
echo 'Error: ' . $t->getMessage();
|
||||
}
|
||||
$out = ob_get_clean();
|
||||
echo $out;
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
// Ejecutar api/get_conversations.php y mostrar salida
|
||||
chdir(__DIR__ . '/../api');
|
||||
ob_start();
|
||||
try {
|
||||
include 'get_conversations.php';
|
||||
} catch (Throwable $t) {
|
||||
echo 'Error: ' . $t->getMessage();
|
||||
}
|
||||
$out = ob_get_clean();
|
||||
echo $out;
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
// Script de prueba para ejecutar api/get_templates.php en modo debug
|
||||
$_GET['debug'] = 'true';
|
||||
chdir(__DIR__ . '/../api');
|
||||
ob_start();
|
||||
try {
|
||||
include 'get_templates.php';
|
||||
} catch (Throwable $t) {
|
||||
echo "Throwable: " . $t->getMessage() . "\n";
|
||||
echo $t->getTraceAsString() . "\n";
|
||||
}
|
||||
$out = ob_get_clean();
|
||||
echo $out;
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
// Test API get_user_conversations.php
|
||||
$_GET['user_id'] = 2;
|
||||
$_GET['debug'] = 'true';
|
||||
chdir(__DIR__ . '/../api');
|
||||
ob_start();
|
||||
try {
|
||||
include 'get_user_conversations.php';
|
||||
} catch (Throwable $t) {
|
||||
echo 'Error: ' . $t->getMessage();
|
||||
}
|
||||
$out = ob_get_clean();
|
||||
echo $out;
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
// Script de prueba para ejecutar api/get_users.php en modo debug
|
||||
$_GET['debug'] = 'true';
|
||||
chdir(__DIR__ . '/../api');
|
||||
ob_start();
|
||||
try {
|
||||
include 'get_users.php';
|
||||
} catch (Throwable $t) {
|
||||
echo "Throwable: " . $t->getMessage() . "\n";
|
||||
echo $t->getTraceAsString() . "\n";
|
||||
}
|
||||
$out = ob_get_clean();
|
||||
echo $out;
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
require_once __DIR__ . '/../services/BotService.php';
|
||||
|
||||
$db = Database::getInstance();
|
||||
$user = $db->fetch('SELECT id, phone_number FROM users LIMIT 1');
|
||||
if (!$user) {
|
||||
echo "No users found\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Mark user as in_service
|
||||
$db->update('users', ['in_service' => 1, 'in_service_by' => 1, 'in_service_at' => date('Y-m-d H:i:s')], 'id = :id', ['id' => $user['id']]);
|
||||
|
||||
// Fetch stale user array (simulate that caller has an old copy without in_service)
|
||||
$staleUser = ['id' => $user['id'], 'phone_number' => $user['phone_number']];
|
||||
|
||||
$bot = new BotService();
|
||||
$bot->processMessage($staleUser, 'hola', 'text');
|
||||
|
||||
echo "processMessage invoked (should have skipped bot processing if in_service)\n";
|
||||
@@ -0,0 +1 @@
|
||||
OK
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
$mid = 'wamid.TEST' . rand(1000,9999);
|
||||
$db->insert('conversations', [
|
||||
'user_id' => 2,
|
||||
'message_id' => $mid,
|
||||
'direction' => 'incoming',
|
||||
'message_type' => 'document',
|
||||
'content' => 'usuarios_blancos.csv',
|
||||
'media_url' => 'https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=1379066300634610&source=webhook&ext=1769010393&hash=EXAMPLE',
|
||||
'status' => 'received'
|
||||
]);
|
||||
$row = $db->fetch('SELECT * FROM conversations WHERE message_id = ?', [$mid]);
|
||||
echo json_encode($row, JSON_PRETTY_PRINT) . "\n";
|
||||
} catch (Throwable $t) {
|
||||
echo 'Error: ' . $t->getMessage() . "\n";
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../api/webhook.php';
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
|
||||
$w = new WhatsAppWebhook();
|
||||
// Build a fake 'value' structure with interactive list_reply
|
||||
$value = [
|
||||
'messages' => [
|
||||
[
|
||||
'from' => '573010000002',
|
||||
'id' => 'TEST_INT_1',
|
||||
'type' => 'interactive',
|
||||
'interactive' => [
|
||||
'type' => 'list_reply',
|
||||
'list_reply' => ['id' => 'option_2', 'title' => 'Consultar resultados']
|
||||
],
|
||||
'timestamp' => time()
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
// Set current menu for user (simulate that menu was shown previously)
|
||||
$db = Database::getInstance();
|
||||
$db->update('users', ['current_menu_id' => 1, 'current_step' => 1], 'phone_number = :phone', ['phone' => '573010000002']);
|
||||
|
||||
// Use reflection to call private method processconversations
|
||||
$ref = new ReflectionClass($w);
|
||||
$m = $ref->getMethod('processconversations');
|
||||
$m->setAccessible(true);
|
||||
|
||||
$m->invoke($w, $value);
|
||||
|
||||
// Check DB for last conversations for that phone
|
||||
$db = Database::getInstance();
|
||||
$user = $db->fetch('SELECT * FROM users WHERE phone_number = ?', ['573010000002']);
|
||||
if ($user) {
|
||||
$rows = $db->fetchAll('SELECT * FROM conversations WHERE user_id = ? ORDER BY created_at DESC LIMIT 5', [$user['id']]);
|
||||
print_r($user);
|
||||
print_r($rows);
|
||||
} else {
|
||||
echo "User not found\n";
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
require_once __DIR__ . '/../classes/MediaService.php';
|
||||
$mediaId = $argv[1] ?? null;
|
||||
if (!$mediaId) { echo "Usage: php test_media_store.php <mediaId>\n"; exit(1); }
|
||||
$ms = new MediaService();
|
||||
try {
|
||||
$res = $ms->fetchAndStoreFromGraph($mediaId, date('Y/m'));
|
||||
echo json_encode($res, JSON_PRETTY_PRINT) . "\n";
|
||||
} catch (Exception $e) {
|
||||
echo "Error: " . $e->getMessage() . "\n";
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
// Usage: php scripts/test_media_url.php <mediaId>
|
||||
$mediaId = $argv[1] ?? '1379066300634610';
|
||||
|
||||
// 1) JSON request (requires auth) - use local cookie session if possible
|
||||
$opts = ['http' => ['method' => 'GET', 'header' => "Accept: application/json\r\n"]];
|
||||
$ctx = stream_context_create($opts);
|
||||
$url = "http://localhost/whatsapp/api/version/media-url.php?id=" . urlencode($mediaId);
|
||||
echo "Requesting JSON -> $url\n";
|
||||
$s = @file_get_contents($url, false, $ctx);
|
||||
if ($s === false) {
|
||||
echo "JSON request failed (probably 401 if not authenticated)\n";
|
||||
} else {
|
||||
echo $s . "\n";
|
||||
}
|
||||
|
||||
// 2) Direct GET (simulate browser) should receive a Location header (we can't follow in this simple test)
|
||||
$headers = get_headers($url, 1);
|
||||
if ($headers) {
|
||||
echo "\nResponse headers:\n";
|
||||
print_r($headers);
|
||||
} else {
|
||||
echo "No headers received (server unreachable)\n";
|
||||
}
|
||||
|
||||
// 3) Proxy download test
|
||||
$downloadUrl = $url . '&download=1';
|
||||
echo "\nDownload test -> $downloadUrl\n";
|
||||
$opts2 = ['http' => ['method' => 'GET']];
|
||||
$ctx2 = stream_context_create($opts2);
|
||||
$stream = @fopen($downloadUrl, 'r', false, $ctx2);
|
||||
if (!$stream) {
|
||||
echo "Download request failed (check server or token)\n";
|
||||
} else {
|
||||
$meta = stream_get_meta_data($stream);
|
||||
echo "Opened stream, meta keys: " . implode(',', array_keys($meta)) . "\n";
|
||||
// Read a small part
|
||||
$part = fread($stream, 200);
|
||||
echo "First bytes:\n" . substr($part,0,200) . "\n";
|
||||
fclose($stream);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
require_once __DIR__ . '/../services/BotService.php';
|
||||
$db = Database::getInstance();
|
||||
$phone = '573010000001';
|
||||
// ensure user
|
||||
$user = $db->fetch('SELECT * FROM users WHERE phone_number = ?', [$phone]);
|
||||
if (!$user) {
|
||||
$id = $db->insert('users', ['phone_number' => $phone, 'status' => 'active', 'created_at' => date('Y-m-d H:i:s')]);
|
||||
$user = $db->fetch('SELECT * FROM users WHERE id = ?', [$id]);
|
||||
}
|
||||
$bot = new BotService();
|
||||
|
||||
echo "User id: {$user['id']} phone: {$phone}\n";
|
||||
|
||||
// Simulate sending 'menu'
|
||||
echo "--- Sending 'menu' ---\n";
|
||||
$bot->processMessage($user, 'menu', 'text');
|
||||
$user = $db->fetch('SELECT * FROM users WHERE id = ?', [$user['id']]);
|
||||
print_r(['after menu user' => $user]);
|
||||
|
||||
// Simulate user selecting option 2
|
||||
echo "--- Sending '2' ---\n";
|
||||
$bot->processMessage($user, '2', 'text');
|
||||
// show last conversation entries
|
||||
$rows = $db->fetchAll('SELECT * FROM conversations WHERE user_id = ? ORDER BY created_at DESC LIMIT 5', [$user['id']]);
|
||||
print_r($rows);
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
require_once __DIR__ . '/../services/BotService.php';
|
||||
$db = Database::getInstance();
|
||||
$phone = '573010000003';
|
||||
// ensure user
|
||||
$user = $db->fetch('SELECT * FROM users WHERE phone_number = ?', [$phone]);
|
||||
if (!$user) {
|
||||
$id = $db->insert('users', ['phone_number' => $phone, 'status' => 'active', 'created_at' => date('Y-m-d H:i:s')]);
|
||||
$user = $db->fetch('SELECT * FROM users WHERE id = ?', [$id]);
|
||||
}
|
||||
$bot = new BotService();
|
||||
|
||||
echo "User id: {$user['id']} phone: {$phone}\n";
|
||||
|
||||
// Simulate incoming message 'Hola'
|
||||
$db->insert('conversations', ['user_id' => $user['id'], 'message_id' => 'INC1', 'direction' => 'incoming', 'message_type' => 'text', 'content' => 'Hola', 'status' => 'received', 'created_at' => date('Y-m-d H:i:s')]);
|
||||
|
||||
// Simulate advisor outgoing reply AFTER the incoming message
|
||||
$db->insert('conversations', ['user_id' => $user['id'], 'message_id' => 'OUT1', 'direction' => 'outgoing', 'message_type' => 'text', 'content' => 'Hola, soy el asesor', 'status' => 'sent', 'created_at' => date('Y-m-d H:i:s')]);
|
||||
|
||||
// Now user sends 'menu'
|
||||
echo "--- Sending 'menu' ---\n";
|
||||
$user = $db->fetch('SELECT * FROM users WHERE id = ?', [$user['id']]);
|
||||
$bot->processMessage($user, 'menu', 'text');
|
||||
$user = $db->fetch('SELECT * FROM users WHERE id = ?', [$user['id']]);
|
||||
print_r(['after menu user' => $user]);
|
||||
|
||||
// Simulate user selecting option 2
|
||||
echo "--- Sending '2' ---\n";
|
||||
$bot->processMessage($user, '2', 'text');
|
||||
$rows = $db->fetchAll('SELECT * FROM conversations WHERE user_id = ? ORDER BY created_at DESC LIMIT 5', [$user['id']]);
|
||||
print_r($rows);
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
require_once __DIR__ . '/../api/webhook.php';
|
||||
|
||||
// Simular payload de mensaje entrante para que webhook cree notificación
|
||||
$payload = [
|
||||
'object' => 'whatsapp_business_account',
|
||||
'entry' => [
|
||||
[
|
||||
'changes' => [
|
||||
[
|
||||
'field' => 'conversations',
|
||||
'value' => [
|
||||
'conversations' => [
|
||||
[
|
||||
'from' => '573019999900',
|
||||
'id' => 'NTFTEST1',
|
||||
'timestamp' => time(),
|
||||
'type' => 'text',
|
||||
'text' => ['body' => 'Notificacion test']
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$w = new WhatsAppWebhook();
|
||||
$w->processPayload($payload);
|
||||
|
||||
$db = Database::getInstance();
|
||||
$rows = $db->fetchAll('SELECT * FROM notifications ORDER BY id DESC LIMIT 5');
|
||||
foreach ($rows as $r) echo json_encode($r) . "\n";
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
echo "TEST START\n";
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
echo "Before config load\n";
|
||||
require_once __DIR__ . '/../config/config_enhanced.php';
|
||||
echo "After config load\n";
|
||||
require_once __DIR__ . '/../classes/Database.php';
|
||||
echo "After DB load\n";
|
||||
require_once __DIR__ . '/../api/webhook.php';
|
||||
echo "After webhook include\n";
|
||||
|
||||
$json = file_get_contents(__DIR__ . '/webhook_payload_ABGGFlA5Fpa.json');
|
||||
$data = json_decode($json, true);
|
||||
try {
|
||||
echo "Calling processPayload...\n";
|
||||
$w = new WhatsAppWebhook();
|
||||
$ok = $w->processPayload($data);
|
||||
echo 'processPayload returned: ' . ($ok ? 'true' : 'false') . PHP_EOL;
|
||||
} catch (Exception $e) {
|
||||
echo 'EXCEPTION: ' . $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
<?php
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once __DIR__ . '/../api/webhook.php';
|
||||
|
||||
$db = Database::getInstance();
|
||||
$webhook = new WhatsAppWebhook();
|
||||
|
||||
// Test reaction
|
||||
$testPhone = '573007777000';
|
||||
$userId = $db->insert('users', ['phone_number' => $testPhone, 'name' => 'Reactor', 'status' => 'active']);
|
||||
$origMsgId = '1001';
|
||||
$db->insert('conversations', [
|
||||
'user_id' => $userId,
|
||||
'message_id' => $origMsgId,
|
||||
'direction' => 'incoming',
|
||||
'message_type' => 'text',
|
||||
'content' => 'Original msg',
|
||||
'status' => 'received',
|
||||
'created_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
|
||||
$payload = [
|
||||
'object' => 'whatsapp_business_account',
|
||||
'entry' => [
|
||||
[
|
||||
'changes' => [
|
||||
[
|
||||
'field' => 'conversations',
|
||||
'value' => [
|
||||
'messaging_product' => 'whatsapp',
|
||||
'metadata' => [
|
||||
'display_phone_number' => '16505551111',
|
||||
'phone_number_id' => '123'
|
||||
],
|
||||
'contacts' => [
|
||||
[ 'profile' => ['name' => 'reactor'], 'wa_id' => $testPhone ]
|
||||
],
|
||||
'conversations' => [
|
||||
[
|
||||
'from' => $testPhone,
|
||||
'id' => '2001',
|
||||
'timestamp' => time(),
|
||||
'type' => 'reaction',
|
||||
'reaction' => ['message_id' => $origMsgId, 'emoji' => '👍']
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$r = $webhook->processPayload($payload);
|
||||
$conv = $db->fetch('SELECT * FROM conversations WHERE message_id = :mid', ['mid' => '2001']);
|
||||
if ($conv) {
|
||||
echo "Reaction saved: reaction_to_message_id={$conv['reaction_to_message_id']}, reaction_emoji={$conv['reaction_emoji']}\n";
|
||||
} else {
|
||||
echo "Reaction not saved\n";
|
||||
}
|
||||
|
||||
// Cleanup reaction test
|
||||
$db->execute('DELETE FROM conversations WHERE message_id = :mid', ['mid' => '2001']);
|
||||
$db->execute('DELETE FROM conversations WHERE message_id = :mid', ['mid' => $origMsgId]);
|
||||
$db->execute('DELETE FROM users WHERE id = :id', ['id' => $userId]);
|
||||
|
||||
// Test reply/context
|
||||
$testPhone2 = '573007777111';
|
||||
$userId2 = $db->insert('users', ['phone_number' => $testPhone2, 'name' => 'Replier', 'status' => 'active']);
|
||||
$origMsgId2 = '1002';
|
||||
$db->insert('conversations', [
|
||||
'user_id' => $userId2,
|
||||
'message_id' => $origMsgId2,
|
||||
'direction' => 'incoming',
|
||||
'message_type' => 'text',
|
||||
'content' => 'Original for reply',
|
||||
'status' => 'received',
|
||||
'created_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
|
||||
$payload2 = [
|
||||
'object' => 'whatsapp_business_account',
|
||||
'entry' => [
|
||||
[
|
||||
'changes' => [
|
||||
[
|
||||
'field' => 'conversations',
|
||||
'value' => [
|
||||
'conversations' => [
|
||||
[
|
||||
'from' => $testPhone2,
|
||||
'id' => '2002',
|
||||
'timestamp' => time(),
|
||||
'type' => 'text',
|
||||
'text' => ['body' => 'Reply message'],
|
||||
'context' => ['id' => $origMsgId2]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$r2 = $webhook->processPayload($payload2);
|
||||
$conv2 = $db->fetch('SELECT * FROM conversations WHERE message_id = :mid', ['mid' => '2002']);
|
||||
if ($conv2) {
|
||||
echo "Reply saved: reply_to_message_id={$conv2['reply_to_message_id']}\n";
|
||||
} else {
|
||||
echo "Reply not saved\n";
|
||||
}
|
||||
|
||||
// Cleanup reply test
|
||||
$db->execute('DELETE FROM conversations WHERE message_id = :mid', ['mid' => '2002']);
|
||||
$db->execute('DELETE FROM conversations WHERE message_id = :mid', ['mid' => $origMsgId2]);
|
||||
$db->execute('DELETE FROM users WHERE id = :id', ['id' => $userId2]);
|
||||
|
||||
echo "Done\n";
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config_enhanced.php';
|
||||
require_once __DIR__ . '/../classes/Database.php';
|
||||
require_once __DIR__ . '/../api/webhook.php';
|
||||
|
||||
try {
|
||||
echo "Starting...\n";
|
||||
$db = Database::getInstance();
|
||||
echo "Got DB\n";
|
||||
$row = $db->fetch('SELECT id, request_body FROM webhook_logs ORDER BY created_at DESC LIMIT 1');
|
||||
echo "Latest log id: " . ($row['id'] ?? 'none') . PHP_EOL;
|
||||
$payload = json_decode($row['request_body'], true);
|
||||
echo "Decoded payload keys: " . implode(',', array_keys($payload)) . PHP_EOL;
|
||||
$w = new WhatsAppWebhook();
|
||||
echo "Webhook instance created\n";
|
||||
$res = $w->processPayload($payload);
|
||||
echo 'ProcessPayload => ' . ($res ? 'OK' : 'FAILED') . PHP_EOL;
|
||||
} catch (Exception $e) {
|
||||
echo 'ERROR: ' . $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
try {
|
||||
require_once __DIR__ . '/../config/config_enhanced.php';
|
||||
echo "config_enhanced OK\n";
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
echo "config.php OK\n";
|
||||
} catch (Throwable $t) {
|
||||
echo "Throwable on require: " . $t->getMessage() . "\n";
|
||||
echo $t->getTraceAsString() . "\n";
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
$wh = new WhatsAppService();
|
||||
$to = '573022548060';
|
||||
$message = 'Prueba de envío (desarrollo) ' . date('Y-m-d H:i:s');
|
||||
try {
|
||||
$res = $wh->sendTextMessage($to, $message);
|
||||
echo "Response:\n";
|
||||
echo json_encode($res, JSON_PRETTY_PRINT) . "\n";
|
||||
} catch (Exception $e) {
|
||||
echo "Error: " . $e->getMessage() . "\n";
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
require_once __DIR__ . '/../services/BotService.php';
|
||||
$db = Database::getInstance();
|
||||
$bot = new BotService();
|
||||
|
||||
$phone = '573011111222';
|
||||
$db->execute('DELETE FROM users WHERE phone_number = :p', ['p' => $phone]);
|
||||
$id = $db->insert('users', ['phone_number' => $phone, 'status' => 'active', 'created_at' => date('Y-m-d H:i:s')]);
|
||||
|
||||
// Ensure welcome_message config exists
|
||||
$message = getConfigFromDB('welcome_message', null);
|
||||
if (!$message) {
|
||||
$m = 'Bienvenido a nuestro servicio (mensaje por defecto)';
|
||||
// Insert config if missing
|
||||
try {
|
||||
$db->insert('system_config', ['config_key' => 'welcome_message', 'config_value' => $m, 'created_at' => date('Y-m-d H:i:s')]);
|
||||
echo "Inserted welcome_message config\n";
|
||||
} catch (Exception $e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
$bot->sendWelcomeMessage($phone);
|
||||
$user = $db->fetch('SELECT * FROM users WHERE id = :id', ['id' => $id]);
|
||||
if (!empty($user['welcome_sent_at'])) {
|
||||
echo "welcome_sent_at recorded: {$user['welcome_sent_at']}\n";
|
||||
} else {
|
||||
echo "welcome_sent_at NOT set\n";
|
||||
}
|
||||
|
||||
// cleanup
|
||||
$db->execute('DELETE FROM users WHERE id = :id', ['id' => $id]);
|
||||
|
||||
echo "Done\n";
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config/config.php';
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
$ids = [3];
|
||||
$placeholders = implode(',', array_fill(0, count($ids), '?'));
|
||||
$existing = $db->fetchAll("SELECT id, name, template_name FROM message_templates WHERE id IN ($placeholders)", $ids);
|
||||
var_export($existing);
|
||||
} catch (Exception $e) {
|
||||
echo "Exception: " . $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once __DIR__ . '/../services/WhatsAppService.php';
|
||||
|
||||
try {
|
||||
$s = new WhatsAppService();
|
||||
echo "WhatsAppService loaded\n";
|
||||
|
||||
echo "Dry-run reaction:\n";
|
||||
$r = $s->sendReaction('573001234567', '<MSGID123>', '❤️', true);
|
||||
print_r($r);
|
||||
|
||||
echo "Dry-run text reply:\n";
|
||||
$rr = $s->sendTextReply('573001234567', '<MSGID123>', 'Gracias por tu mensaje', false, true);
|
||||
print_r($rr);
|
||||
|
||||
} catch (Throwable $t) {
|
||||
echo "ERROR: " . $t->getMessage() . "\n";
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
echo "START wa_service_test\n";
|
||||
require_once __DIR__ . '/../services/WhatsAppService.php';
|
||||
echo "AFTER REQUIRE\n";
|
||||
|
||||
try {
|
||||
$s = new WhatsAppService();
|
||||
echo "WhatsAppService OK\n";
|
||||
} catch (Throwable $t) {
|
||||
echo "ERROR: " . $t->getMessage() . "\n";
|
||||
echo $t->getTraceAsString() . "\n";
|
||||
}
|
||||
echo "END wa_service_test\n";
|
||||
@@ -1,102 +0,0 @@
|
||||
<?php
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once __DIR__ . '/../api/webhook.php';
|
||||
|
||||
$payload = [
|
||||
"object" => "whatsapp_business_account",
|
||||
"entry" => [
|
||||
[
|
||||
"id" => "0",
|
||||
"changes" => [
|
||||
[
|
||||
"field" => "conversations",
|
||||
"value" => [
|
||||
"messaging_product" => "whatsapp",
|
||||
"metadata" => [
|
||||
"display_phone_number" => "16505551111",
|
||||
"phone_number_id" => "123456123"
|
||||
],
|
||||
"contacts" => [
|
||||
[
|
||||
"profile" => ["name" => "test user name"],
|
||||
"wa_id" => "16315551181"
|
||||
]
|
||||
],
|
||||
"conversations" => [
|
||||
[
|
||||
"from" => "16315551181",
|
||||
"id" => "ABGGFlA5Fpa",
|
||||
"timestamp" => "1504902988",
|
||||
"type" => "text",
|
||||
"text" => ["body" => "this is a text message"]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
try {
|
||||
$w = new WhatsAppWebhook();
|
||||
echo "Webhook instance created\n";
|
||||
$result = $w->processPayload($payload);
|
||||
echo "processPayload result: " . ($result ? 'true' : 'false') . "\n";
|
||||
|
||||
// Simular reacción entrante
|
||||
$reactionPayload = [
|
||||
"object" => "whatsapp_business_account",
|
||||
"entry" => [
|
||||
[
|
||||
"id" => "0",
|
||||
"changes" => [
|
||||
[
|
||||
"field" => "conversations",
|
||||
"value" => [
|
||||
"messaging_product" => "whatsapp",
|
||||
"metadata" => [
|
||||
"display_phone_number" => "16505551111",
|
||||
"phone_number_id" => "123456123"
|
||||
],
|
||||
"contacts" => [
|
||||
[
|
||||
"profile" => ["name" => "reactor"],
|
||||
"wa_id" => "16315551181"
|
||||
]
|
||||
],
|
||||
"conversations" => [
|
||||
[
|
||||
"from" => "16315551181",
|
||||
"id" => "REACTION1",
|
||||
"timestamp" => "1504902990",
|
||||
"type" => "reaction",
|
||||
"reaction" => ["message_id" => "ABGGFlA5Fpa", "emoji" => "❤️"]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$r2 = $w->processPayload($reactionPayload);
|
||||
echo "processReaction result: " . ($r2 ? 'true' : 'false') . "\n";
|
||||
|
||||
} catch (Throwable $t) {
|
||||
echo "Fatal: " . $t->getMessage() . "\n";
|
||||
echo $t->getTraceAsString() . "\n";
|
||||
}
|
||||
|
||||
// Show last lines of system log
|
||||
$log = __DIR__ . '/../logs/system.log';
|
||||
if (file_exists($log)) {
|
||||
echo "-- Last log lines --\n";
|
||||
$lines = array_slice(file($log), -40);
|
||||
foreach ($lines as $line) echo $line;
|
||||
} else {
|
||||
echo "No log file found\n";
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once __DIR__ . '/../api/webhook.php';
|
||||
|
||||
try {
|
||||
$w = new WhatsAppWebhook();
|
||||
echo "Webhook instance OK\n";
|
||||
} catch (Throwable $t) {
|
||||
echo "ERROR: " . $t->getMessage() . "\n";
|
||||
echo $t->getTraceAsString() . "\n";
|
||||
}
|
||||
Reference in New Issue
Block a user