<?php
require_once __DIR__ . '/../config/config_enhanced.php';
require_once __DIR__ . '/../config/config.php';
require_once __DIR__ . '/../api/webhook.php';

// Simular GET verification

action:

$_SERVER['REQUEST_METHOD'] = 'GET';
$_GET['hub_mode'] = 'subscribe';
$_GET['hub_verify_token'] = WEBHOOK_VERIFY_TOKEN;
$_GET['hub_challenge'] = 'testchallenge123';

try {
    $w = new WhatsAppWebhook();
    ob_start();
    $w->handleRequest();
    $out = ob_get_clean();
    echo "Output:\n" . $out . "\n";
} catch (Throwable $t) {
    echo "Throwable: " . $t->getMessage() . "\n";
    echo $t->getTraceAsString() . "\n";
}
