Matrix webhook receiver for Prometheus/Alertmanager
  • Nix 49.1%
  • Go 41.1%
  • Shell 5.9%
  • Go Template 3.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Pablo Ovelleiro Corral 95749bd5c2
Merge pull request #5 from Stunkymonkey/readme-https
README: fix MX_HOMESERVER protocol
2025-06-09 22:25:41 +02:00
.github Fix vendor script 2023-10-05 14:54:55 +02:00
pkgs go.mod: bump go version 2023-09-11 15:53:30 +02:00
scripts add dependabot integrations 2023-09-11 15:53:19 +02:00
.gitignore Add flake 2021-11-30 12:54:26 +01:00
flake.lock Update flake.lock 2023-09-11 15:13:53 +02:00
flake.nix add dependabot integrations 2023-09-11 15:53:19 +02:00
go.mod go.mod: bump go version 2023-09-11 15:53:30 +02:00
go.sum go.mod: bump go version 2023-09-11 15:53:30 +02:00
LICENSE Initial commit 2021-11-30 12:18:52 +01:00
main.go Add plaintext handler 2021-12-02 09:22:14 +01:00
message.html.tmpl add emoji to template 2021-12-01 14:23:50 +01:00
mock.json use golang templates for message 2021-12-01 14:13:51 +01:00
module.nix Use package with overlay 2022-04-15 11:09:23 +02:00
README.md README: fix MX_HOMESERVER protocol 2025-06-07 10:53:42 +02:00

matrix-hook

Matrix webhook receiver based on matrix-alertmanager-receiver. Listens for webhooks from promehteus alertmanager and sends a message to a matrix channel.

Configuration is done with environment variables.

Variable Description Example
HTTP_ADDRESS Adress to listen on localhost
HTTP_PORT Port to listen on 8080
MX_HOMESERVER Matrix homeserver https://matrix.org
MX_ID Matrix user ID @mr_panic:matrix.org
MX_ROOMID Matrix room to join !ilXTTTTTTuDmsz:matrix.org
MX_TOKEN Matrix access token rstienrsrseintrisetnrte
MX_MSG_TEMPLATE Path to message templaate ./message.html.tmpl

Nix

For Nix/Nixos users a flake.nix is provided to simplify the build. It also privides app to test the hooks with mocked data from mock.json

Build

nix build

Run directly

nix run

Test alerts

nix run '.#mock-hook'

Module

The flake also includes a NixOS module for ease of use. A minimal configuration will look like this:


# Add to flake inputs
inputs.matrix-hook.url = "github:pinpox/matrix-hook";

# Import the module in your configuration.nix
imports = [
  self.inputs.matrix-hook.nixosModules.matrix-hook
];

# Enable and set options
services.matrix-hook = {
  enable = true;
  httpAddress = "localhost";
  matrixHomeserver = "https://matrix.org";
  matrixUser = "@mr_panic:matrix.org";
  matrixRoom = "!ilXXXXXXXXXXXXXXXz:matrix.org";
  envFile = "/var/src/secrets/matrix-hook/envfile";
  msgTemplatePath = "${self.inputs.matrix-hook.packages."x86_64-linux".matrix-hook}/bin/message.html.tmpl";
};