Type Alias PushoverMessage

PushoverMessage: {
    emergencyOpts?: {
        callback?: string;
        expire: number;
        retry: number;
        tags?: string[];
    };
    html?: boolean;
    link?: string
    | { title?: string; url: string };
    message: string;
    monospace?: boolean;
    priority?: 0 | 1 | 2 | -2 | -1;
    sound?: string;
    timestamp?: number;
    title?: string;
    ttl?: number;
}

Defines the structure for a Pushover message object used when calling the send method.

This type represents the complete set of parameters you can provide for a Pushover notification. It includes the required message field and various optional fields to customize the notification's appearance, behavior, priority, sound, and delivery options.

Refer to the official Pushover API documentation for detailed explanations of each field. Note the specific constraints:

  • emergencyOpts must be provided if priority is set to 2.
  • html and monospace formatting options cannot be used together.

Type declaration

  • OptionalemergencyOpts?: { callback?: string; expire: number; retry: number; tags?: string[] }

    Emergency priority options, required when priority is 2.

    • Optionalcallback?: string

      An optional callback URL that Pushover servers will send a request to when the notification has been acknowledged.

    • expire: number

      Specifies how long (in seconds) the notification will continue to be resent. Maximum value is 10800 seconds (3 hours).

    • retry: number

      Specifies how often (in seconds) the Pushover servers will send the same notification to the user. Minimum value is 30 seconds.

    • Optionaltags?: string[]

      Optional tags for emergency notifications. Helps with cancelling retries.

  • Optionalhtml?: boolean

    If set to true, the message content will be treated as HTML. Mutually exclusive with monospace.

  • Optionallink?: string | { title?: string; url: string }

    An optional link attached to the message. Can be either a simple URL string or an object containing the URL and an optional display title.

  • message: string

    The message content sent to the user. Must be at least 3 characters long.

  • Optionalmonospace?: boolean

    If set to true, the message content will be displayed using a monospace font. Mutually exclusive with html.

  • Optionalpriority?: 0 | 1 | 2 | -2 | -1

    Sets the notification priority for the message. Defaults to 0 (normal priority).

    • -2: Message only, no notification sound/vibration. May increment the notification bubble.
    • -1: Silent notification (no sound/vibration).
    • 0: Default notification behavior.
    • 1: High priority, ignores user's quiet hours.
    • 2: Emergency priority, requires acknowledgement. Requires emergencyOpts.
  • Optionalsound?: string

    The name of one of the predefined Pushover sounds or a custom sound uploaded by the user to be played for the notification.

  • Optionaltimestamp?: number

    An optional Unix timestamp representing the message's date and time to display to the user, rather than the time Pushover received it.

  • Optionaltitle?: string

    An optional title for the message.

  • Optionalttl?: number

    Time To Live in seconds. Specifies how long the message will be kept until disappearing.

import type { PushoverMessage } from '@cis-oss/pushover';

const standardMessage: PushoverMessage = {
message: "Deployment successful!",
title: "Server Update",
priority: 1, // High priority
sound: "pushover",
link: {
url: "https://example.com/deployment/status",
title: "View Status"
}
};

const emergencyMessage: PushoverMessage = {
message: "System critical: Service down!",
priority: 2,
emergencyOpts: {
retry: 60, // Retry every 60 seconds
expire: 3600, // Expire after 1 hour
tags: ["critical", "infra"]
},
};