The Messenger of Allah ﷺ came to us in the gathering of Saad bin Ubada.Bashir bin Saad said to him, "Allah has commanded us to send blessings upon you, Messenger of Allah. So how should we send blessings upon you?"The Messenger of Allah ﷺ remained silent for so long that we wished he had not asked him. Then he said, "Say, 'O Allah, send blessings upon Muhammad and upon the family of Muhammad, as You sent blessings upon Ibrahim, and bless Muhammad and the family of Muhammad as You blessed the family of Ibrahim among all peoples. Indeed, You are Praiseworthy and Glorious.' And the salutation is as you already know."
أتانا رسول الله ﷺ في مجلس سعد بن عبادة: فقال له بشير بن سعد: أمرنا الله أن نصلي عليك يا رسول الله، فكيف نصلي عليك؟ قال: فسكت رسول الله ﷺ حتى تمنينا أنه لم يسأله ثم قال: قولوا: اللهم صل على محمد وعلى آل محمد، كما صليت على إبراهيم، وبارك على محمد وعلى آل محمد كما باركت على آل إبراهيم في العالمين إنك حميد مجيد، والسلام كما علمتم.
Malik narrated it in the chapter on shortening the prayer (67) from Naeem bin Abdullah Mujmir, from Muhammad bin Abdullah bin Zayd, that he informed him from Abu Masud Ansari, who mentioned something similar. Muslim narrated it in the chapter on prayer (405) from Yahya bin Yahya, from Malik, with the same wording. Ibn Khuzayma and others added, "How should we invoke blessings upon you when we invoke blessings upon you in our prayer."