Anas bin Malik reported,

The Emigrants and the Helpers began digging the trench around Madinah, carrying the dirt on their backs and chanting, "We are the ones who pledged allegiance to Muhammad upon Islam, for as long as we live, forever."The Prophet ﷺ would respond to them, saying, "O Allah, there is no good except the good of the Hereafter, so bless the Helpers and the Emigrants."

Azami 10503

Sahih

عن أنس قال

جعل المهاجرون والأنصار يحفرون الخندق حول المدينة، وينقلون التراب على متونهم ويقولون: نحن الذين بايعوا محمدا على الإسلام ما بقينا أبدا والنبي ﷺ يجيبهم ويقول: اللهم أنه لا خير إلا خير الآخرة فبارك في الأنصار والمهاجره.

الأعظمي 10503صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Virtues of the tribes
Section
Supplication for the Ansar and the Muhajirun for righteousness, forgiveness, blessing, victory, and honor
Numbering
Jami al-Kamil 10503 (2nd edition)