Skip to content

Webhooks

Matrix via Maubot

To send notifications to Matrix one way is using maubot and the mauboot-webhook plugin

Maubot config

You need to create a new instance of the mauboot-webhook plugin as basic config you can use the following.

path: /send
method: post
room: '<Room ID>'
message: |
    # {{ json.title }}
    {% if "hostname" in json.fields %}
    Host: `{{ json.fields.hostname }}`
    {% endif %}
    {% if "type" in json.fields %}
    Type: `{{ json.fields.type }}`
    {% endif %}
    Severity: `{{ json.severity }}`  
    ```
    {{ json.message }}
    ```
message_format: markdown
message_type: m.text
auth_type: Bearer
auth_token: <Auth Secret>
force_json: false
ignore_empty_messages: false

Proxmox config

To send the data in the correct format you need to create a Notification Target under Datacenter > Notification.

Method: POST

URL: https://<Maubot Instance>/_matrix/maubot/plugin/<Plugin Instance>/send

Headers: - authorization: Bearer {{ secrets.token }} - content-type: application/json

Body:

{
"title": "{{ title }}",
"message": "{{ escape message }}",
"severity": "{{ severity }}",
"fields": {{ json fields }}
}

Secrets: - token: <Auth Secret from maubot instance>

Now you can create Notification Matchers to route notifications to your Matrix room.