Question: how to retrieve deleted messages of iphone?
Answer: Log into iCloud.com with your Apple ID and password.
Click on Text Messages. ... 
Search the messages to find the ones you need.
Now go to your iPhone and choose Settings > [your name] > iCloud.
Turn off Text Messages (or make sure it's already turned off).