Abu Hurairah reported,

The Prophet ﷺ sent some cavalry toward Najd, and they brought back a man from the tribe of Banu Hanifa called Thumama bin Uthal. They tied him to one of the pillars of the mosque.The Prophet ﷺ came out to him and said, "Release Thumama."He went to a grove of palm trees near the mosque, performed a full bath, then entered the mosque and said, "I bear witness that there is no god but Allah, and that Muhammad is the Messenger of Allah."

Bukhari 462

Sahih

حدثنا عبد الله بن يوسف قال حدثنا الليث قال حدثنا سعيد بن أبي سعيد سمع

أبا هريرة قال

بعث النبي ﷺ خيلا قبل نجد فجاءت برجل من بني حنيفة يقال له ثمامة بن أثال فربطوه بسارية من سواري المسجد فخرج إليه النبي ﷺ فقال أطلقوا ثمامة فانطلق إلى نخل قريب من المسجد فاغتسل ثم دخل المسجد فقال أشهد أن لا إله إلا الله وأن محمدا رسول الله

البخاري 462صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Prayer
Chapter
Bathing upon accepting Islam, and tying up prisoners in the masjid as well
Numbering
Darussalam 462
Bukhari 462