Allamah al-Majlisi records:
إكمال الدين: بهذا الاسناد، عن أبان بن تغلب قال: قال أبو عبد الله عليه السلام:سيأتي في مسجدكم ثلاثمائة وثلاثة عشر رجلا - يعني مسجد مكة - يعلم أهل مكة أنه لم يلدهم آباؤهم ولا أجدادهم، عليهم السيوف، مكتوب على كل سيف كلمة تفتح ألف كلمة، فيبعث الله تبارك وتعالى ريحا فتنادي بكل واد: هذا المهدي يقضي بقضاء داود وسليمان عليهما السلام لا يريد عليه بينة.
Ikmal al-Din: Through this chain, from Aban b. Taghlib:
Abu ‘Abd Allah, peace be upon him, said: “There will be in your mosque, that is the mosque of Kufa, 313 men. The people of Makkah will know that they (i.e. the 313 men) are not descended from their (i.e. the Makkans’) fathers and ancestors. They (i.e. the 313 men) will have swords; on each sword will be inscribed a statement which will open one thousand (other) statements. Then, Allah the Most Blessed and the Most High will send a wind which will call in every valley: ‘This is the Mahdi.’ He will judge with the judgment of Dawud and Sulayman, peace be upon them both: he will not demand for evidence on it.”
Here is the commentary of the hadith.
Apart from prophets, messengers, and some other righteous people, our Creator also sends wahy to Imams:
وجعلناهم أئمة يهدون بأمرنا وأوحينا إليهم فعل الخيرات وإقام الصلاة وإيتاء الزكاة وكانوا لنا عابدين
And We appointed them Imams, guiding by Our Command, and We sent wahy to them to do good deeds, and to keep up al-salat, and to pay al-zakat. And, they were worshippers of Us.43
It is indeed notable that the receipt of the wahy has been explicitly linked with their office of Imamah in this instance. This establishes absolutely that a true Imam too receives some wahy from Allah. Of course, al-Mahdi is an Imam “sent” by Him from the offspring of Ibrahim, Isma’il, Muhammad and ‘Ali, ‘alaihim al-salam