There are three ways to recover deleted messages from iPhone. One way is to scan and recover deleted messages from your iPhone directly. One way is to regain your lost iPhone messages by extracting your iTunes backup file. Another way is to restore fromiCLoud backup files.
For more detailed instruction, please go to How to recover deleted iPhone text messages
Note: If you want to use the second method, please make sure that you have made backup of the iPhone with iTunes before the messages were deleted.