Kaab bin Ujra met me and said, "Shall I give you a gift? The Prophet ﷺ came out to us, and we said, 'Messenger of Allah, we already know how to greet you with peace, but how should we send blessings upon you?'He replied, 'Say, O Allah, send blessings upon Muhammad and upon the family of Muhammad, as You sent blessings upon the family of Ibrahim. Indeed, You are Praiseworthy, Glorious. O Allah, bestow favor upon Muhammad and upon the family of Muhammad, as You bestowed favor upon the family of Ibrahim. Indeed, You are Praiseworthy, Glorious.'"
لقيني كعب بن عجرة فقال: ألا أهدي لك هدية؟ إن النبي ﷺ خرج علينا، فقلنا: يا رسول الله! قد علمنا كيف نسلم عليك، فكيف نصلي عليك؟ قال: فقولوا: اللهم صل على محمد، وعلى آل محمد، كما صليت على آل إبراهيم إنك حميد مجيد، اللهم بارك على محمد، وعلى آل محمد، كما باركت على آل إبراهيم، إنك حميد مجيد.
Bukhari related it in "Supplications" (6357), and Muslim in "Prayer" (406), both through the route of Shubah, who said, Hakam told us, I heard Abdul-Rahman bin Abu Layla say, and then he mentioned it.In a version found in Bukhari (3370), through the route of Abdullah bin Isa, who heard Abdul-Rahman bin Abu Layla say, Kaab bin Ujra met me and said, "Shall I not give you a gift I heard from the Prophet ﷺ?" I said, "Yes, give it to me." He said, "We asked the Messenger of Allah ﷺ, and we said, 'Messenger of Allah, how should we pray upon you, the People of the House, for Allah has taught us how to send greetings upon you?'" Then he mentioned something similar, except that in it he said, "as You sent prayers upon Ibrahim and upon the family of Ibrahim" and "as You blessed Ibrahim and the family of Ibrahim." Hakam did not mention "Ibrahim" alone in his account, but rather mentioned "the family of Ibrahim" in both places.The sahih hadiths explicitly contain three wordings, "Ibrahim" alone, "the family of Ibrahim" alone, and the combination of both, "Ibrahim and his family," and this variation goes back to the narrators, some abbreviating and some giving fuller detail.As for his statement, "We have learned how to send greetings upon you," this means what we learned in the tashahhud, namely his saying, "Peace be upon you, O Prophet, and the mercy of Allah and His blessings."