There's no need to continue to apologize for the past. It's over, done with. It's the present that counts. Actions speak louder than words. A positive, confident attitude goes a long way.
DB kids. Listen without forming a reply. If you feel angry, walk away, telling the kids that you'll continue when you're in a better place. Anytime they talk, when you respond, use fewer words than they did.
This is a tough time, stuck with the mountains of legal paperwork, the steady nastiness of your divorcing spouse and now feeling the kids are turned against you.
Eventually the kids figure it out. One parent demeaning the other always comes back to bite 'em in the ass. Focus on being the best person you can be in mind body and spirit, growing to be the best dad, letting go of the texts she sends you.
Talk to your lawyer about her harassment, see if there's anything that can be done.
In the end, it's you.. and your choice in how you make your home a safe place for the kids. Never put down their mom to their face or in earshot, or share details about the divorce.
Set the boundaries, let the kids know the consequences for their actions. And family therapy might prove to be very helpful.
Keep you chin up. They're worth it. You're worth it.