Planekeeper is currently in alpha development. Features and APIs may change. Feedback is welcome! Request early access to get started.

Template variables

Complete reference of template variables available in notification templates, organized by event category with example snippets.

Notification templates use Go template syntax to insert dynamic values into webhook payloads. Variables are enclosed in double curly braces: {{.VariableName}}.

Common variables

These variables are available in all template categories.

VariableTypeDescription
{{.IdempotencyKey}}stringUUID that remains stable across retries for the same delivery
{{.Event}}stringEvent type that triggered the notification
{{.Timestamp}}stringISO 8601 timestamp of when the event occurred
{{.Alert.ID}}numberUnique alert identifier
{{.Alert.ConfigName}}stringName of the alert configuration
{{.Alert.RuleName}}stringName of the monitoring rule
{{.Alert.RuleType}}stringRule type: days_behind, majors_behind, or minors_behind
{{.Alert.Severity}}stringCurrent severity: critical, high, or moderate
{{.Alert.DiscoveredVersion}}stringVersion found in your repository
{{.Alert.LatestVersion}}stringLatest upstream version available
{{.Alert.BehindBy}}numberHow far behind (days, major versions, or minor versions)
{{.Alert.ArtifactName}}stringUpstream artifact identifier (e.g., github.com/kubernetes/kubernetes)
{{.Alert.RepositoryURL}}stringGit repository URL from the scrape job
{{.Alert.TargetFile}}stringFile path parsed by the scrape job

New alert templates

Use the new_alert template category for alert.created and alert.escalated events. These templates fire when a new violation is detected or an existing alert increases in severity.

Additional variables

VariableTypeDescription
{{.AcknowledgeURL}}stringOne-click acknowledgment URL for external systems
{{.PreviousSeverity}}stringPrevious severity level (only present on escalation events)

Example: simple text

{
  "text": "ALERT: {{.Alert.ConfigName}} - {{.Alert.DiscoveredVersion}} is {{.Alert.BehindBy}} {{.Alert.RuleType}} behind latest ({{.Alert.LatestVersion}}). Severity: {{.Alert.Severity | upper}}"
}
{
  "text": "{{.Alert.Severity | upper}}: {{.Alert.ConfigName}}\nCurrent: {{.Alert.DiscoveredVersion}} | Latest: {{.Alert.LatestVersion}}\nBehind by: {{.Alert.BehindBy}}\nAcknowledge: {{.AcknowledgeURL}}"
}

Acknowledged templates

Use the acknowledged template category for alert.acknowledged and alert.unacknowledged events. These templates fire when a user acknowledges an alert or when an acknowledgment is reset due to a version change.

Additional variables

VariableTypeDescription
{{.IsAcknowledged}}booleantrue for acknowledged, false for unacknowledged
{{.AcknowledgedBy}}stringEmail or identifier of the user who acknowledged
{{.AcknowledgedAt}}stringISO 8601 timestamp of when the acknowledgment occurred

Example: conditional text

{
  "text": "{{if .IsAcknowledged}}Acknowledged{{else}}Unacknowledged{{end}}: {{.Alert.ConfigName}} ({{.Alert.ArtifactName}}){{if .IsAcknowledged}} by {{.AcknowledgedBy}}{{end}}"
}

Resolved templates

Use the resolved template category for alert.resolved events. These templates fire when a version update causes the alert to no longer violate its rule.

Additional variables

VariableTypeDescription
{{.ResolvedAt}}stringISO 8601 timestamp of when the alert was resolved

Example

{
  "text": "Resolved: {{.Alert.ConfigName}} - {{.Alert.ArtifactName}} is no longer behind. Resolved at {{.ResolvedAt}}"
}

Template functions

Three built-in functions transform values inline.

FunctionSyntaxInputOutput
upper{{.Alert.Severity | upper}}criticalCRITICAL
lower{{.Event | lower}}Alert.Createdalert.created
json{{.Alert | json}}(object){"id":1,"severity":"critical",...}

Using functions in templates

Pipe a variable to a function with the | operator:

{"text": "{{.Alert.Severity | upper}} ALERT: {{.Alert.ConfigName}}"}

This produces: CRITICAL ALERT: My Alert Config


Template resolution priority

When Planekeeper sends a notification, it looks for a template in this order:

  1. Channel-specific template – set in the notification channel’s event_templates configuration
  2. Organization-level template – set via the Settings page
  3. Global default template – set at the system level
  4. Standard JSON payload – the built-in default format with no template applied

The first non-empty template found is used. Leave a template blank at any level to fall back to the next level.


Event-to-category mapping

Event typeTemplate category
alert.creatednew_alert
alert.escalatednew_alert
testnew_alert
alert.acknowledgedacknowledged
alert.unacknowledgedacknowledged
alert.resolvedresolved

Escaping special characters

Templates are embedded inside JSON strings. Escape these characters:

CharacterEscape sequence
Double quote\"
Newline\n
Backslash\\
Tab\t
{"text": "Alert: {{.Alert.ConfigName}}\nSeverity: {{.Alert.Severity | upper}}\nVersion: {{.Alert.DiscoveredVersion}}"}
success

Test before enabling

Use the channel test button to verify your template produces valid output for the target platform. Template syntax errors are caught during the test and reported in the results.