We present a quantum-field-theoretical framework based on path integrals and Feynman diagrams for the investigation of the quantum-optical properties of one-dimensional waveguiding structures with embedded quantum impurities. In particular, we obtain the Green's functions for a waveguide with an embedded two-level system in the single-and two-excitation sector for arbitrary dispersion relations both in the time and the frequency domain. In the single excitation sector, we show how to sum the diagrammatic perturbation series to all orders and thus obtain explicit expressions for physical quantities such as the spectral density and the scattering matrix. In the two-excitation sector, we show that strictly linear dispersion relations exhibit the special property that the corresponding diagrammatic perturbation series terminates after two terms, again allowing for closed-form expressions for physical quantities. In the case of general dispersion relations, notably those exhibiting a band edge or waveguide cut-off frequencies, the perturbation series cannot be summed explicitly. Instead, we derive a self-consistent T -matrix equation that reduces the computational effort to that of a single-excitation computation. This analysis allows us to identify a Fano resonance between the occupied quantum impurity and a free photon in the waveguide as a unique signature of the fewphoton nonlinearity inherent in such systems. In addition, our diagrammatic approach allows for the classification of different physical processes such as the creation of photon-photon correlations and interaction-induced radiation trapping -the latter being absent for strictly linear dispersion relations. Our framework can serve as the basis for further studies that involve more complex scenarios such as several and many-level quantum impurities, networks of coupled waveguides, disordered systems, and non-equilibrium effects.