There’s a lot of good suggestions, but I’d be interested in finding services which provides an API and a fairly easy way to interact with the messages from a script.
Currently I’m limited to Telegram, and the occasional Discord connection, though none of these are encrypted.
Simplex chat has a command line client. You may beable to hack a api from that.
I also believe matrix has some sort of api