We used to recite the tahiyyat during prayer, mentioning names and greeting one another. The Messenger of Allah ﷺ heard us and said, "Say, 'All greetings, prayers, and good things belong to Allah. Peace be upon you, Prophet, and the mercy of Allah and His blessings. Peace be upon us and upon the righteous servants of Allah. I bear witness that there is no god but Allah, and I bear witness that Muhammad is His servant and messenger.' For when you say this, you have greeted every righteous servant of Allah in the heavens and the earth."
حدثنا عمرو بن عيسى حدثنا أبو عبد الصمد عبد العزيز بن عبد الصمد حدثنا حصين بن عبد الرحمن عن أبي وائل
كنا نقول التحية في الصلاة ونسمي ويسلم بعضنا على بعض فسمعه رسول الله ﷺ فقال قولوا التحيات لله والصلوات والطيبات السلام عليك أيها النبي ورحمة الله وبركاته السلام علينا وعلى عباد الله الصالحين أشهد أن لا إله إلا الله وأشهد أن محمدا عبده ورسوله فإنكم إذا فعلتم ذلك فقد سلمتم على كل عبد لله صالح في السماء والأرض