From correlation functions to scattering amplitudes