No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-05 23:21:15 +02:00
go.mod Make go module more lenient 2026-07-27 04:25:40 +02:00
go.sum Make go module more lenient 2026-07-27 04:25:40 +02:00
README.md Update README 2026-08-05 23:21:15 +02:00
uptimekuma-matrix.go Fix heartbeat not unmarshalling when ping is not an integer 2026-08-05 23:18:02 +02:00

uptimekuma-matrix

Very simple UptimeKuma webhook receiver for Matrix written in Go. Has more features than plain UptimeKuma:

  • Custom templates
  • Markdown support
  • Can switch m.text/m.notice

Very easy to configure.

Running

Get a binary, go build or whatever, figure it out, you seem like a smart guy.
Usage:

uptimekuma-matrix [-help] [-addr string] [-port int]
  -addr string
        the address to bind to (default "0.0.0.0")
  -help
        shows this help
  -port int
        the port to listen on (default 1234)

Using

  1. Create a "notification" of type "Webhook", give it a cute name, and set the URL to wherever the webhook receiver can be reached
  2. Set "Request Body" to the application/json "preset"
  3. Enable "Additional Headers" and add the following structure:
{
  "X-Matrix-Room": "!room-id-here",
  "X-Matrix-CSAPI": "https://matrix.homeserver.tld",
  "X-Matrix-Token": "token-here",
  "X-Matrix-ID": "@uptimekuma:homeserver.tld",
}

replacing each with appropriate values.

Headers

  • X-Matrix-Room (required): the Matrix room ID. Needs to be known in the database of the homeserver that will be used
  • X-Matrix-CSAPI (required): the URL where the Client-Server Matrix API can be reached. The most reliable way to find this URL, is to use an external federation tester, to have it resolve the C-S endpoint for you. I recommend mtrnord's
  • X-Matrix-Token (required): the access token that was generated by authenticating against the homeserver that will be used. Tools like mbc can be useful, but stripping a cookie from your favorite Matrix client will work too
  • X-Matrix-ID (required): the MXID of the user in canonical form (@localpart:homeserver.tld) that belongs to the token.
  • X-Matrix-Type (optional): the message type, should be either m.text or m.notice (default m.notice)
  • X-Matrix-Template (optional): a Go template for the message to send on Matrix, you have the following pieces of data available (top level is a HeartbeatEvent):
type Heartbeat struct {
	MonitorID      int   
	Status         int   
	Time           string
	Msg            string
	Ping           int   
	Important      bool  
	Retries        int   
	Timezone       string
	TimezoneOffset string
	LocalDateTime  string
	LastDownTime   string
}

type Monitor struct {
	ID          int   
	Name        string
	Description string
	PathName    string
	URL         string
}

type HeartbeatEvent struct {
	Message   string   
	Monitor   Monitor  
	Heartbeat Heartbeat
}

Default is {{.Message}}, so just whatever UptimeKuma gives you by default.