post('/webhooks/chatwoot', [ChatwootWebhookHandler::class, 'handle']); // Tools (called by Flowise or external) $router->post('/tools/new_ticket', [NewTicketHandler::class, 'handle']); $router->post('/tools/get_order_data', [WooToolsHandler::class, 'getOrderData']); $router->post('/tools/get_product_data', [WooToolsHandler::class, 'getProductData']); $router->post('/tools/get_shipping_data', [WooToolsHandler::class, 'getShippingData']); $router->post('/tools/get_payment_methods', [WooToolsHandler::class, 'getPaymentMethods']); $router->post('/tools/get_product_compatibility', [WooToolsHandler::class, 'getProductCompatibility']); $router->post('/tools/get_car_data', [WooToolsHandler::class, 'getCarData']); // ── Dispatch ─────────────────────────────────────────────────────── $method = $_SERVER['REQUEST_METHOD'] ?? 'GET'; $path = $_GET['__path'] ?? (parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH) ?: '/'); $path = '/' . trim((string)$path, '/'); $rawBody = file_get_contents('php://input') ?: ''; Logger::info('Incoming request', [ 'method' => $method, 'uri' => $_SERVER['REQUEST_URI'] ?? null, 'ip' => $_SERVER['REMOTE_ADDR'] ?? null, 'ua' => $_SERVER['HTTP_USER_AGENT'] ?? null, ]); if ($rawBody !== '') { // UWAGA: czasem payload jest duży; możesz obciąć do np. 50k Logger::debug('Incoming body', [ 'body' => json_decode($rawBody, true) ?? $rawBody ]); } $router->dispatch($method, $path);