Skip to content

Custom template for ntfy (or any service provider?) #6797

@epifeny

Description

@epifeny

📑 I have found these related issues/pull requests

Custom notification message templates with variable substitution

🔖 Feature description

Add support for custom notification message templates using a {{variable}} syntax, allowing users to customize notification titles and messages with dynamic values from their monitors (e.g., {{name}}, {{status}}, {{hostname}}).

This would give users more control over notification content and make messages more compact and personalized. For example, instead of the default verbose messages, users could create concise templates like "{{statusEmoji}} {{name}}" for the title.

✔️ Solution

I've created a POC for the ntfy notification provider that includes:

  • Custom title and message template fields at the notification level
  • A collapsible UI section that expands when templates are configured
  • Variable substitution that works with any monitor field

Screenshots showing the implementation:

  • Collapsed by default when empty
  • Expanded view with template fields
  • Sample notifications with custom templates

I'd like guidance on extending this to:

  1. Make it available for other notification providers (Discord, Gotify, etc.)
  2. Add per-monitor template overrides (allowing each monitor to customize its messages beyond the notification-level templates)

❓ Alternatives

For per-monitor templates, I explored adding fields to the monitor table and handling them in core files, but I'm uncertain if this is the right approach. There might be a cleaner way to implement provider-specific per-monitor settings that I'm not aware of.

Another alternative would be to keep it notification-level only, but that seems limiting for users with diverse monitoring needs.

📝 Additional Context

The button collapsed by default when empty:

Image

The button expanded when configured:

Image

Sample notifications with custom templates:

Image

I'm new to contributing to Uptime Kuma, so any direction on the best architectural approach would be appreciated. This feature was requested 3-4 years ago on Reddit, so there seems to be community interest.
https://www.reddit.com/r/UptimeKuma/comments/x2p7v1/compact_notification_messages_or_modify/
https://www.reddit.com/r/UptimeKuma/comments/r9oeq0/modify_email_template/

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestRequest for new features to be added

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions