AlphornAlphorn Docs

Message Format and Templates

Choose how Alphorn turns incoming webhook payloads into notifications - Auto-detect known sources, generic detection, or custom title, message, tags, and priority templates.

Tools send webhooks in their own shapes. Each Alphorn webhook has a Message format setting that decides how the JSON body becomes a notification title, message, priority, and tags. Set it when creating a webhook, or later in Webhooks → (your webhook) → Edit.

ModeWhat it does
Auto-detect (default)Recognizes supported sources such as GitHub, Sentry, Stripe, or Alertmanager and formats each event type. Other payloads use the generic detection.
None (generic)Picks title and message from common fields (title, message, body, ...). Falls back to the raw JSON.
Custom templateFour template fields resolve {path.to.field} against the payload. Empty fields use the generic detection.

Webhooks that already had templates before this setting existed were migrated to Custom template; all others use Auto-detect.

Order of precedence

For each field, Alphorn uses the first source that produces a value:

  1. Auto-detect only: if the request matches a known source, its formatter produces title, message, priority, and tags, and nothing below is consulted. See Supported Sources.
  2. Custom template only: the webhook's template for that field
  3. For Slack-compatible payloads: the Slack text, blocks, or attachments (title and message only)
  4. The generic detection below
  5. For the message only: the whole JSON body, pretty-printed

Priority and tags have no Slack step. In Custom template mode, a priority template that resolves to an empty value (for example the field is missing) falls back to the body's numeric priority field. If it resolves to something that isn't a number (e.g. critical), the notification has no priority - there is no fallback in that case.

Titles are capped at 200 characters and messages at 4000; longer values are truncated. The full body is always stored as payload for filtering.

Plain-text requests are not JSON: they use the X-Title, X-Priority, and X-Tags headers instead (see Webhooks).

Generic detection

Used by None (generic), by Auto-detect when no source matches, and per field by Custom template when a field is empty. Alphorn walks the body plus common wrapper keys (issue, pull_request, data, event, submission, object, payload, form_response) and picks the first string-valued field from:

  • Title candidates: title, subject, name, headline
  • Message candidates: message, body, msg, text, content, description, summary

Top-level priority (number, clamped into 1-5) and tags (array or comma-separated string) are read directly. If present, a top-level action string is prefixed to the title (opened: Some issue title).

If nothing matches, the message renders as the full JSON body.

Custom template

Choose Custom template to fill in four fields:

FieldProducesNotes
Title templatetitle (≤ 200 chars)Short headline, truncated if longer
Message templatemessage (≤ 4000 chars)Notification body, truncated if longer
Tags templatetags[]Comma-separated; each part trimmed, empty parts dropped
Priority templatepriority (1-5)Must resolve to a number. Rounded and clamped into 1-5

Each template can be up to 500 characters long.

Syntax

Templates use {dotted.path} placeholders resolved against the JSON request body:

  • {title} → body.title
  • {repository.full_name} → body.repository.full_name
  • {alerts.0.labels.severity} → the first entry of the alerts array (array items are addressed by index)

Missing paths, objects, and arrays render as empty; strings, numbers, and booleans are inserted as text. There are no conditionals, loops, or helpers - just substitution. That's intentional: templates stay predictable and can't be used to smuggle logic or secrets.

Templates only apply to JSON bodies.

Request headers

Request headers are available under $headers, using lower-case header names - for example {$headers.host}. Placeholders only allow letters, digits, _, and ., so headers with a hyphen in their name (like X-GitHub-Event or User-Agent) can't be referenced. Known sources that need such headers are handled by Auto-detect instead.

Sensitive headers are removed before templates see them: Authorization, Cookie, Set-Cookie, Proxy-Authorization, and anything starting with X-Auth or X-Api.

Examples

Custom templates are useful for tools Auto-detect does not cover. A generic app that posts {"level": "error", "service": "api", "error": {"text": "..."}}:

Title:    {service}: {level}
Message:  {error.text}
Tags:     app,{service},{level}
Priority: 4

Alertmanager-style arrays are addressed by index, e.g. {alerts.0.labels.severity} is the severity of the first alert. (Alertmanager itself is already handled by Auto-detect.)

Tips

  • Priority can't branch on values in a custom template. If you need different priorities per severity, create separate webhooks or keep priority constant and route severities to different channels via filter rules.
  • Narrow event delivery at the source. Most services let you pick which events each webhook URL receives.
  • The full body is always stored as payload and available for filtering rules, so you don't have to cram everything into the message.
  • Just want to route the original webhook? Use the Forward channel. Auto-detect still powers filters.

On this page