Question: how to retrieve accidentally deleted texts on 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).