Depending on how complete and detailed they are, the text messages may well constitute a sufficient writing to satisfy the Statute of Frauds (the statute that requires some contracts to be in writing to be enforceable; of course, this doesn't mean that the text messages satisfy all other requirements of a valid contract). However, most agreements do not have to be in writing to be enforceable. Assuming that your agreement was to sublet the apartment for a term of less than a year, it probably was not required to be in writing. Thus, if all other elements of a contract were met (consideration, agreement on all material terms, etc.), and that the apartment was in good condition as you say, your damages would be the difference in rent between what the original prospective subtenant agreed to pay and what the second subtenant paid.