In two-dimensional statistical models possessing a discretely holomorphic parafermion, we introduce a modified discrete Cauchy-Riemann equation on the boundary of the domain, and we show that the solution of this equation yields integrable boundary Boltzmann weights. This approach is applied to (i) the square-lattice O(n) loop model, where the exact locations of the special and ordinary transitions are recovered, and (ii) the Fateev-Zamolodchikov $Z_N$ spin model, where a new rotation-invariant, integrable boundary condition is discovered for generic $N$.