feat: add Pushover notification template (addresses #392)

Added built-in Pushover template alongside Discord, Telegram, Gotify, and ntfy. Users can now select Pushover from the service dropdown instead of manually configuring it as a generic webhook.
This commit is contained in:
Pulse Monitor 2025-09-04 13:47:50 +00:00
parent 3650930a23
commit 6cb33f13da
2 changed files with 21 additions and 1 deletions

View file

@ -134,6 +134,7 @@ export function WebhookConfig(props: WebhookConfigProps) {
teams: 'Microsoft Teams',
'teams-adaptive': 'Teams (Adaptive)',
pagerduty: 'PagerDuty',
pushover: 'Pushover',
gotify: 'Gotify',
ntfy: 'ntfy'
};
@ -251,7 +252,7 @@ export function WebhookConfig(props: WebhookConfigProps) {
<Show when={showServiceDropdown()}>
<div class="grid grid-cols-1 md:grid-cols-2 gap-2 p-4 bg-gray-50 dark:bg-gray-700/50 rounded-lg mb-4">
<For each={['generic', 'discord', 'slack', 'telegram', 'teams', 'teams-adaptive', 'pagerduty', 'gotify', 'ntfy']}>
<For each={['generic', 'discord', 'slack', 'telegram', 'teams', 'teams-adaptive', 'pagerduty', 'pushover', 'gotify', 'ntfy']}>
{(service) => (
<button type="button"
onClick={() => selectService(service)}
@ -271,6 +272,7 @@ export function WebhookConfig(props: WebhookConfigProps) {
service === 'telegram' ? 'Telegram bot notifications' :
service === 'teams' ? 'Microsoft Teams webhook' :
service === 'teams-adaptive' ? 'Teams with Adaptive Cards' :
service === 'pushover' ? 'Mobile push notifications' :
service === 'gotify' ? 'Self-hosted push notifications' :
service === 'ntfy' ? 'Push notifications via ntfy.sh' :
'PagerDuty Events API v2'}

View file

@ -230,6 +230,24 @@ func GetWebhookTemplates() []WebhookTemplate {
}`,
Instructions: "1. In Teams channel, click ... > Connectors\n2. Configure Incoming Webhook\n3. Copy the URL and paste it here\n\nThis uses the modern Adaptive Card format recommended for new implementations.",
},
{
Service: "pushover",
Name: "Pushover",
URLPattern: "https://api.pushover.net/1/messages.json",
Method: "POST",
Headers: map[string]string{"Content-Type": "application/json"},
PayloadTemplate: `{
"token": "{{.CustomFields.app_token}}",
"user": "{{.CustomFields.user_token}}",
"title": "Pulse Alert: {{.Level | title}} - {{.ResourceName}}",
"message": "{{.Message}}\n\n• Resource: {{.ResourceName}}\n• Node: {{.Node}}\n• Type: {{.Type | title}}\n• Value: {{if or (eq .Type "diskRead") (eq .Type "diskWrite")}}{{printf "%.1f" .Value}} MB/s{{else}}{{printf "%.1f" .Value}}%{{end}}\n• Threshold: {{if or (eq .Type "diskRead") (eq .Type "diskWrite")}}{{printf "%.0f" .Threshold}} MB/s{{else}}{{printf "%.0f" .Threshold}}%{{end}}\n• Duration: {{.Duration}}",
"priority": {{if eq .Level "critical"}}1{{else if eq .Level "warning"}}0{{else}}-1{{end}},
"sound": "{{if eq .Level "critical"}}siren{{else if eq .Level "warning"}}tugboat{{else}}pushover{{end}}",
"device": "{{.ResourceName}}",
"timestamp": "{{.Timestamp}}"
}`,
Instructions: "1. Create an application at https://pushover.net/apps\n2. Copy your Application Token\n3. Get your User Key from your Pushover dashboard\n4. URL: https://api.pushover.net/1/messages.json\n5. Add custom fields:\n • app_token: YOUR_APP_TOKEN\n • user_token: YOUR_USER_KEY",
},
{
Service: "gotify",
Name: "Gotify",