To learn how to retrieve a deleted message or conversation if you were using iOS 16 or iPadOS 16.1 or later, read this support article --> Recover deleted text messages on your iPhone or iPad - Apple Support
You need iOS 16, iPadOS 16.1, (you have iOS 12) 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 were using a mobile device OS version prior to 16, were using iCloud with Messages and deleted them, they are gone permanently. If you were not using iCloud with messages you may be able to restore them from a backup but only if you are prepared to revert the entire contents of your device back to the time when the backup was made. See this Apple Recommended 2021 post by ASC contributor Chris0107: trying to ser if theres a way i can recov… - Apple Community