Experimental approaches to transient protein interactions are laborious and serendipitous, and our understanding of fundamental questions like the identification of interaction surfaces or the specificity of molecular recognition between interacting proteins are far from being solved. We propose a maximum-entropy approach based on recent techniques from the statistical physics of disordered systems, which exploits the natural sequence variability of homologous proteins across hundreds of species species. Applying this approach to bacterial signal transduction as a test case, we show that our method is able (i) to identify inter-protein residue contacts and to facilitate the prediction of high-resolution protein complex strutures, and (ii) to reconstruct a protein-protein interaction code which elucidates specificity in signal transduction in bacteria.