#1940·ntfy

Alertmanager template renders firing end time incorrectly

Author: deferredCreated Sep 8, 2026Updated Sep 25, 2026

:lady_beetle: Describe the bug

The built-in alertmanager template renders Alertmanager firing alerts with the zero end time. It also removes the newline before Ends at:.

The bundled firing fixture contains:

json
"startsAt": "2025-07-17T07:00:00Z",
"endsAt": "0001-01-01T00:00:00Z"

With ?template=alertmanager, ntfy renders:

Starts at: 2025-07-17T07:00:00ZEnds at: 0001-01-01T00:00:00Z

A firing alert has no end time. The template should omit Ends at: when endsAt is 0001-01-01T00:00:00Z. It should also keep Ends at: on its own line when the alert is resolved.

The issue is in the built-in template:

yaml
Starts at: {{ .startsAt }}
{{- if .endsAt }}Ends at: {{ .endsAt }}{{ end }}

endsAt is a non-empty JSON string, so the condition is true. The leading - also trims the preceding newline.

:computer: Components impacted

ntfy server, built-in alertmanager message template

:bulb: Screenshots and/or logs

The bundled firing Alertmanager payload reproduces this:

https://github.com/binwiederhier/ntfy/blob/main/server/testdata/webhook_alertmanager_firing.json

The current template is here:

https://github.com/binwiederhier/ntfy/blob/main/server/templates/alertmanager.yml