總理各國事務衙門
As foreign troops invaded Beijing during the Second Opium War and the Xianfeng Emperor fled to Chengde, Wenxiang remained in the capital and took part in negotiating with the British and French. Following the peace settlement, he became one of the founders of the new Qing foreign office, the Zongli Yamen. He was one of the architects behind the Self-strengthening movement and was instrumental in devising the Qing government's cooperative policy towards the Western powers in the period 1861–76.