`). The code carries the workspace, so the webhook * can link the channel without any persisted state. The returned `nonce` lets * the UI recognise its own connection on the broadcast channel. */ public function connect(Request $request): JsonResponse { $this->ensurePlatformEnabled(); $workspace = $request->user()->currentWorkspace; abort_if($workspace === null, SymfonyResponse::HTTP_CONFLICT, 'No active workspace.'); $this->authorize('manageAccounts', $workspace); $expiresAt = now()->addMinutes(15); $code = TelegramConnectCode::issue($workspace->id, $expiresAt); return response()->json([ 'code' => $code, 'nonce' => data_get(TelegramConnectCode::decode($code), 'nonce'), 'bot_username' => config('trypost.platforms.telegram.bot_username'), 'expires_at' => $expiresAt->toIso8601String(), ]); } }