It is usually possible to retrieve a deleted text message by restoring your phone to a previous backup, or by using a third-party app. The exact process for retrieving a text varies depending on the model of the phone.
Most smartphone models allow the user to back up data for added security. To retrieve a text message from an iPhone by restoring to a previous backup, plug the phone into your PC or Mac and open iTunes. Select your iPhone in the top right corner of the screen, then select "Restore Backup." Note that restoring a previous backup erases all data entered after the backup was created.
To retrieve deleted text messages on Android devices, download and install a third party device such as Wondershare Dr. Fone for Android. Access Developer Options in the main settings menu on the phone. Check the box beside USB Debugging. With the recovery program still running, connect your phone to your computer via USB. Follow the onscreen instructions to analyze the data on your device. Once you have done so, the program displays a list of items on your phone and whether or not you have deleted them. Select the text messages you wish to retrieve and select the Recover action to restore them to your phone. It is also possible to save the text messages directly to your PC for archival purposes.