Feature request: matrix alerting

Tags: #<Tag:0x00007f84a56aa780>

It would be very nice if support for alerting via Matrix could be added.
As far as I know, no one has written a client SDK in php yet, however the Drupal integration might be useful

1 Like

Seconding this feature request. Having my synapse server alert me automatically if/when stuff goes down would be fantastic.

maubot already exists, so the only thing that would be needed is a webhook-based plugin. The github, gitlab, and gitea maubot plugins already have webhook support, so they could be used as templates.

Okay, so I’ve got it halfway figured out using the API Alert Transport.

Get an access_token for the synapse user you want to send the alert.
API Method: PUT
API URL: https://<your_server>/_matrix/client/r0/rooms/<room_id:your_server>/send/m.room.message/
Options: access_token=<access_token_for_whatever_user_you_want_to_post_the_message>
headers: Accept: application/json
body: {"body": "<text_here>", "msgtype": "m.text"}

A couple things, though.
· There needs to be an additional string at the end of the URL, this is the txnId (more info here). The flagship client Element is using “m.date +%s” to generate the string, but this doesn’t look possible in LibreNMS using the current API Alert Transport. If the txnId is not unique, I do not believe new Alerts will be posted to the synapse room.
· I’m also not sure how to get the Alerts themselves into the body of the template.

I too am looking for this information there does not appear to be many people using this feature.