'mock_test_session', 'phone' => '1234567890', 'message' => 'test' ]); $ch = curl_init($sendUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', 'X-Webhook-Secret: ' . getenv('WEBHOOK_SECRET') ]); curl_setopt($ch, CURLOPT_TIMEOUT, 5); $sendResponse = curl_exec($ch); $sendHttpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $sendError = curl_error($ch); curl_close($ch); echo json_encode([ 'env' => [ 'WHATSAPP_GATEWAY_URL' => getenv('WHATSAPP_GATEWAY_URL'), 'WEBHOOK_SECRET_SET' => !empty(getenv('WEBHOOK_SECRET')), 'APP_URL' => getenv('APP_URL') ], 'gateway_health' => [ 'url' => $gatewayUrl . '/health', 'http_code' => $healthHttpCode, 'response' => json_decode($healthResponse, true) ?: $healthResponse, 'error' => $healthError ], 'gateway_send_test' => [ 'url' => $sendUrl, 'http_code' => $sendHttpCode, 'response' => json_decode($sendResponse, true) ?: $sendResponse, 'error' => $sendError ], 'chatbot_rules' => $rules, 'messages_log' => $logs, 'whatsapp_sessions' => $sessions ], JSON_PRETTY_PRINT);