Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bayhaqi:7088Abū Manṣūr al-Ẓufur b. Muḥammad al-ʿAlawī Imlāʾ > Abū Bakr Muḥammad b. Jaʿfar al-Ādamī > Aḥmad b. ʿUbayd b. Nāṣiḥ al-Naḥwī > ʿAlī b. ʿĀṣim > Muḥammad b. Sūqah > Ibrāhīm > al-Aswad > ʿAbdullāh b. Masʿūd

[Machine] The Messenger of Allah ﷺ said, "Whoever consoles a bereaved person, he will have a reward equal to his (the bereaved person's) reward." This was specifically attributed to Ali ibn Asim, although it has also been narrated from others. And Allah knows best.  

البيهقي:٧٠٨٨حَدَّثَنَا أَبُو مَنْصُورٍ الظُّفُرُ بْنُ مُحَمَّدٍ الْعَلَوِيُّ إِمْلَاءً أنبأ أَبُو بَكْرٍ مُحَمَّدُ بْنُ جَعْفَرٍ الْآدَمِيُّ بِبَغْدَادَ ثنا أَحْمَدُ بْنُ عُبَيْدِ بْنِ نَاصِحٍ النَّحْوِيُّ ثنا عَلِيُّ بْنُ عَاصِمٍ ثنا مُحَمَّدُ بْنُ سُوقَةَ عَنْ إِبْرَاهِيمَ عَنِ الْأَسْوَدِ عَنْ عَبْدِ اللهِ بْنِ مَسْعُودٍ قَالَ

قَالَ رَسُولُ اللهِ ﷺ مَنْ عَزَّى مُصَابًا فَلَهُ مِثْلُ أَجْرِهِ تَفَرَّدَ بِهِ عَلِيُّ بْنُ عَاصِمٍ وَهُوَ أَحَدُ مَا أُنْكِرَ عَلَيْهِ وَقَدْ رُوِيَ أَيْضًا عَنْ غَيْرِهِ وَاللهُ أَعْلَمُ