Anas (May Allah be pleased with him) reported:
Some Companions happened to pass by a funeral procession (bier) and they praised him (the deceased). The Prophet (ﷺ) said, "He will certainly enter it." Then they passed by another funeral procession and they spoke ill of the deceased. The Prophet (ﷺ) said, "He will certainly enter it." `Umar bin Al-Khattab (May Allah be pleased with him) said: "(O Messenger of Allah,) what do you mean by `He will certainly enter it?'' He (ﷺ) replied, "You praised the first person, so he will enter Jannah; and you spoke ill of the second person, so he will enter Hell. You are Allah's witnesses on earth."[Al-Bukhari and Muslim].
App reference: Book 7, Hadith 56
Arabic/English book reference: Book 7, Hadith 950