To recover deleted messages on iPhone with iCloud:
- Open the Settings app and tap your name at the top.
- Select iCloud > iCloud Backup and check that your iPhone has been backed up recently.
- Go back to the main Settings menu and select General.
- Scroll down and click Reset > Erase all Content and Settings > Erase now.