Integrability for correlation functions