You could use something like matrix-commander to implement this.
Matrix servers don't have an api where you can just make stuff happen, but you can have a user that has admin privileges in the rooms you want to control, and then have that user controlled by whatever you want.
I use matrix-commander to have my auto-update script notify me when it updates a bridge, for example.