Three Ways to Recover Deleted Messages on your iPhone or iPad.

From old iTunes backup files:
Please download the Windows version of Tansee iPhone Message Transfer from here and the Mac version from here.
Open Tansee iPhone Message Transfer without connecting your iPhone to the computer.
Tansee will automatically read the old iTunes backup file, allowing you to find and copy old messages.
From your iPhone directly:
Tansee can retrieve deleted messages from the 'free space' of the SMS database file.
It is uncertain which messages were in the free space, including their dates and the number of deleted messages.
Open Tansee, connect your iPhone, and once Tansee has read all the messages, click on the 'Deleted Messages' tab.
You have the option to recover conversations and messages that you deleted within the Messages app:
1. In Messages, tap Edit on the conversations page. If you previously turned Message Filtering on, the Edit button doesn't appear. Instead, tap Filters on the conversations page.
2. Tap Show Recently Deleted.
3. Choose the conversations with the messages you want to restore, then tap Recover.
4. Tap Recover Message or Recover [Number] Messages. You need iOS 16, iPadOS 16.1, or later to recover deleted messages and conversations. You can only recover messages and conversations that you deleted within the last 30 to 40 days. If you delete a message before you update to iOS 16, iPadOS 16, or later, you can't recover that message.