We report $ab$ $initio$ band diagram and optical absorption spectra of hexagonal boron nitride ($h$-BN), focusing on unravelling how the completeness of basis set for $GW$ calculations and how electron-phonon interactions (EPIs) impact on them. The completeness of basis set, an issue which was seldom discussed in previous optical spectra calculations of $h$-BN, is found crucial in providing converged quasiparticle band gaps. In the comparison among three different codes, we demonstrate that by including high-energy local orbitals in the all-electron linearized augmented plane waves based $GW$ calculations, the quasiparticle direct and fundamental indirect band gaps are widened by $sim$0.2 eV, giving values of 6.81 eV and 6.25 eV respectively at the $GW_0$ level. EPIs, on the other hand, reduce them to 6.62 eV and 6.03 eV respectively at 0 K, and 6.60 eV and 5.98 eV respectively at 300 K. With clamped crystal structure, the first peak of the absorption spectrum is at 6.07 eV, originating from the direct exciton contributed by electron transitions around $K$ in the Brillouin zone. After including the EPIs-renormalized quasiparticles in the Bethe-Salpeter equation, the exciton-phonon coupling shifts the first peak to 5.83 eV at 300 K, lower than the experimental value of $sim$6.00 eV. This accuracy is acceptable to an $ab$ $initio$ description of excited states with no fitting parameter.