Abdullah bin Abu Awfa wrote to him, and I read the letter. In it was that the Messenger of Allah ﷺ said, "Do not wish to meet the enemy, and ask Allah for well-being. But when you meet them, stand firm, and know that Paradise lies beneath the shade of swords."Then he said, "O Allah, Revealer of the Book, Mover of the clouds, Defeater of the confederates, defeat them and grant us victory over them."
كتب إليه عبد الله بن أبى أوفى، فقرأته، فإذا فيه أن رسول الله ﷺ قال: لا تتمنوا لقاء العدو، وسلوا الله العافية، فإذا لقيتموهم فاصبروا واعلموا أن الجنة تحت ظلال السيوف. ثم قال: اللهم منزل الكتاب ومجري السحاب وهازم الأحزاب اهزمهم وانصرنا عليهم.
Bukhari related it in jihad and campaigns (2965-2966), and Muslim in jihad and campaigns (1742), both by way of Musa bin Uqba, from Salim Abu Nadr, the freed slave of Umar bin Ubaydullah, who narrated it. The wording given is Bukhari's, and Muslim's wording is similar.