Skip to content

Matrix Notifier#

Element screenshot with room ID

The matrix notifier sends unencrypted messages to Matrix chat rooms. The room ID where to post the messages is required. In the Element Matrix client, the ID can be found under Room SettingsAdvancedInternal room ID. An access token is required for the Matrix account that should be used to send the messages from.

Configuration#

event:
  notifiers:
    matrix:
      # enable matrix notifications
      enable: true
      channels:
          # Matrix server and access token to send messages from
        - server: https://matrix.example.net
          access_token:
            file: /run/secrets/room_access_token
          # Matrix room ID
          internal_room_id: local_room_id:server.example.net
          # event filter
          events:
            - ARP_NEIGHBOR_UNKNOWN
            - IPV6_NEIGHBOR_UNKNOWN

See also: schema description

Template#

The message will be formated using the matrix.html.j2 template file:

<!doctype html>
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>[IXpect] {{name}} triggered in {{batch_count}} batches</title>
</head>

<body>
  <h1>{{name}} triggered in {{batch_count}} batches</h1>

  <table border="1">
    <thead>
      <tr>
        <th>Events</th>
        <th>Timestamp</th>
        <th>ID</th>
        <th>Data</th>
      </tr>
    </thead>

    <tbody>
      {% for batch in batches %}
      <tr>
        <td>{{batch.size}}</td>
        <td>{{batch.timestamp}}</td>
        <td>{{batch.id}}</td>
        <td>
          <pre>{{batch.data}}</pre>
        </td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
</body>

</html>