Muhammad ibn Ya‘qub from Ali ibn Ibrahim from his father from Abdullah ibn Jundab, who said:
I asked Abu al-Hasan al-Madi عليه السلام, peace be upon him, about what I should say in the prostration of gratitude, for our companions have differed concerning it. Imam عليه السلام said: “Say while you are in prostration: ‘O Allah سبحانه وتعالى, I call You عز وجل to witness, and I call Your عز وجل angels, Your عز وجل prophets, Your عز وجل messengers, and all of Your عز وجل creation to witness, that indeed You are Allah سبحانه وتعالى, my Lord عز وجل, and Islam is my religion, and Muhammad صلى الله عليه وعلى آله وسلم is my Prophet, and Ali عليه السلام and so-and-so عليه السلام and so-and-so عليه السلام until the last of them are my Imams عليه السلام. Through them I express loyalty, and from their enemies I disassociate. O Allah سبحانه وتعالى, I implore You عز وجل by the blood of the wronged one, three times. O Allah سبحانه وتعالى, I implore You عز وجل by Your عز وجل commitment to Yourself عز وجل for the sake of Your عز وجل allies, that You عز وجل will grant them victory over Your عز وجل enemy and their enemy. I ask You عز وجل to send blessings upon Muhammad صلى الله عليه وعلى آله وسلم and the family of Muhammad صلى الله عليه وعلى آله وسلم, and upon the entrusted ones among the family of Muhammad صلى الله عليه وعلى آله وسلم. O Allah سبحانه وتعالى, I ask You عز وجل for ease after hardship, three times.’ Then place your right cheek on the ground and say: ‘O my refuge when paths fail me and the earth, despite its vastness, becomes narrow for me. O Creator عز وجل of my form, have mercy on me, for You عز وجل created me out of mercy, and You عز وجل are independent of Your عز وجل creation. Send blessings upon Muhammad صلى الله عليه وعلى آله وسلم and the family of Muhammad صلى الله عليه وعلى آله وسلم and upon the entrusted ones from the family of Muhammad صلى الله عليه وعلى آله وسلم.’ Then place your left cheek on the ground and say: ‘O Subduer of every tyrant, O Honorer of every one brought low, by Your عز وجل might, I have reached my limit, three times.’ Then say: ‘O Compassionate, O Bestower, O Remover of great hardships, three times.’ Then return to prostration and say one hundred times: ‘Shukran, shukran (Thanks).’ Then ask Allah سبحانه وتعالى for your need, if Allah سبحانه وتعالى wills.”