A time-dependent analysis of the $B_s^0 to phigamma$ decay rate is performed to determine the $CP$-violating observables $S_{phigamma}$ and $C_{phigamma}$, and the mixing-induced observable $mathcal{A}^{Delta}_{phigamma}$. The measurement is based on a sample of $pp$ collision data recorded with the LHCb detector, corresponding to an integrated luminosity of 3 fb$^{-1}$ at center-of-mass energies of 7 and 8 TeV. The measured values are begin{align*} S_{phigamma} &= 0.43 pm 0.30 pm 0.11, C_{phigamma} &= 0.11 pm 0.29 pm 0.11, mathcal{A}^{Delta}_{phigamma} &= -0.67 , ^{+0.37}_{-0.41} pm 0.17, end{align*} where the first uncertainty is statistical and the second systematic. This is the first measurement of the observables $S$ and $C$ in radiative $B_s^0$ decays. The results are consistent with the Standard Model predictions.