There are ways to send iMessages programmatically. Apple does check for spam, but it’s not foolproof. And of course, it won’t help you against a targeted attack.
I didn’t research it that much, but a good place to start would be AirMessage [1] or Mautrix [2]. Both of these require a Mac to work – it might work on a Hackintosh, though, or maybe using same tricks those forks of OpenHaystack use to run without a Mac (no pointers here, sorry). Hope this helps!