Check whether Messages in iCloud was enabled on your iPhone
Sign in to the same Apple ID on your iPhone
Connect your iPhone to Wi-Fi
Go to Settings
Tap your name
Tap iCloud
Turn on Messages
Wait for messages to sync from iCloud
Restore your iPhone from an iCloud backup that contains the messages
Go to Settings
Tap General
Tap Transfer or Reset iPhone
Tap Erase All Content and Settings
Set up your iPhone again
Choose Restore from iCloud Backup
Sign in with your Apple ID
Select the backup that includes your text messages
Check other Apple devices signed in to the same Apple ID
Open the Messages app on each device
Make sure Messages in iCloud is enabled on each device
Contact Apple Support if the messages do not appear
