Under New York’s Family Court Act, the protected party, the party whose favor the order of protection is issued, may not be held to violate an order issued, nor can the protected party be arrested for violating such order. Therefore, under New York law, given that there is an order of protection against you, you are not allowed to communicate with your ex-spouse.
In contrast, however, your spouse is not prohibited from reaching out to you. This leads to the unfortunate situation, which in New York is not against the law, where your ex-spouse is legally allowed to send you text messages which you cannot reply to. The best course of action to move forward with your life without the unpleasant text messages is to obtain an order of protection against her.
Keep in mind, under New York law, as described more in depth here, to obtain an order of protection against your ex-spouse you will need to establish “good cause.” Good cause could likely be established by providing the court copies of the text messages your ex-spouse has sent.
Please contact a New York State Attorney who has experience in these matters and an understanding of New York law for legal advice. To be clear, this answer is not legal advice.