feat: Add Pushover notification channel

- Adds Pushover as a new notification channel option. Includes fields for `api_token` and `user_key` in the `alert_configurations` schema and integrates it into the channel type dropdown and form handling.
This commit is contained in:
Tola Leng
2025-08-23 20:10:03 +07:00
parent d01f682a83
commit b3b64806f6
3 changed files with 59 additions and 3 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

@@ -36,7 +36,7 @@ interface NotificationChannelDialogProps {
const baseSchema = z.object({
notify_name: z.string().min(1, "Name is required"),
notification_type: z.enum(["telegram", "discord", "slack", "signal", "google_chat", "email", "ntfy", "webhook"]),
notification_type: z.enum(["telegram", "discord", "slack", "signal", "google_chat", "email", "ntfy", "pushover", "webhook"]),
enabled: z.boolean().default(true),
service_id: z.string().default("global"),
template_id: z.string().optional(),
@@ -89,6 +89,12 @@ const webhookSchema = baseSchema.extend({
webhook_payload_template: z.string().optional(),
});
const pushoverSchema = baseSchema.extend({
notification_type: z.literal("pushover"),
api_token: z.string().min(1, "API token is required"),
user_key: z.string().min(1, "User key is required"),
});
const formSchema = z.discriminatedUnion("notification_type", [
telegramSchema,
discordSchema,
@@ -97,7 +103,8 @@ const formSchema = z.discriminatedUnion("notification_type", [
googleChatSchema,
emailSchema,
ntfySchema,
webhookSchema
pushoverSchema,
webhookSchema,
]);
type FormValues = z.infer<typeof formSchema>;
@@ -145,6 +152,12 @@ const notificationTypeOptions = [
description: "Send notifications via NTFY push service",
icon: "/upload/notification/ntfy.png"
},
{
value: "pushover",
label: "Pushover",
description: "Send push notifications via Pushover",
icon: "/upload/notification/pushover.png"
},
{
value: "webhook",
label: "Webhook",
@@ -570,6 +583,43 @@ export const NotificationChannelDialog = ({
)}
/>
)}
{notificationType === "pushover" && (
<>
<FormField
control={form.control}
name="api_token"
render={({ field }) => (
<FormItem>
<FormLabel>API Token</FormLabel>
<FormControl>
<Input placeholder="Your Pushover API token" {...field} type="password" />
</FormControl>
<FormDescription>
Your Pushover application API token
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="user_key"
render={({ field }) => (
<FormItem>
<FormLabel>User Key</FormLabel>
<FormControl>
<Input placeholder="Your Pushover user key" {...field} />
</FormControl>
<FormDescription>
Your Pushover user key (or group key)
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
</>
)}
{notificationType === "webhook" && (
<>
@@ -7,7 +7,7 @@ export interface AlertConfiguration {
collectionId?: string;
collectionName?: string;
service_id: string;
notification_type: "telegram" | "discord" | "slack" | "signal" | "google_chat" | "email" | "ntfy" | "webhook";
notification_type: "telegram" | "discord" | "slack" | "signal" | "google_chat" | "email" | "ntfy" | "pushover" | "webhook";
telegram_chat_id?: string;
discord_webhook_url?: string;
signal_number?: string;
@@ -29,6 +29,8 @@ export interface AlertConfiguration {
webhook_id?: string;
channel_id?: string;
ntfy_endpoint?: string;
api_token?: string;
user_key?: string;
webhook_url?: string;
webhook_payload_template?: string;
}
@@ -85,6 +87,10 @@ export const alertConfigService = {
} else if (config.notification_type === "ntfy") {
cleanConfig.ntfy_endpoint = config.ntfy_endpoint || "";
} else if (config.notification_type === "pushover") {
cleanConfig.api_token = config.api_token || "";
cleanConfig.user_key = config.user_key || "";
} else if (config.notification_type === "webhook") {
cleanConfig.webhook_url = config.webhook_url || "";