notifier

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatMessage

func FormatMessage(p *Payload) string

Types

type DiscordSender

type DiscordSender struct {
	AllowPrivate bool
}

func (*DiscordSender) Send

func (s *DiscordSender) Send(ctx context.Context, channel *storage.NotificationChannel, payload *Payload) error

func (*DiscordSender) Type

func (s *DiscordSender) Type() string

type DiscordSettings

type DiscordSettings struct {
	WebhookURL string `json:"webhook_url"`
}

type Dispatcher

type Dispatcher struct {
	// contains filtered or unexported fields
}

func NewDispatcher

func NewDispatcher(store storage.Store, logger *slog.Logger, allowPrivateTargets bool) *Dispatcher

func (*Dispatcher) NotifyChannels added in v1.2.0

func (d *Dispatcher) NotifyChannels(channelIDs []int64, payload *Payload)

NotifyChannels sends a notification to specific channels by ID, bypassing event subscription filters.

func (*Dispatcher) NotifyForMonitor

func (d *Dispatcher) NotifyForMonitor(monitorID int64, payload *Payload)

func (*Dispatcher) NotifyWithPayload

func (d *Dispatcher) NotifyWithPayload(payload *Payload)

func (*Dispatcher) RegisterSender

func (d *Dispatcher) RegisterSender(s Sender)

func (*Dispatcher) SendTest

type EmailSender

type EmailSender struct{}

func (*EmailSender) Send

func (s *EmailSender) Send(ctx context.Context, channel *storage.NotificationChannel, payload *Payload) error

func (*EmailSender) Type

func (s *EmailSender) Type() string

type EmailSettings

type EmailSettings struct {
	Host     string   `json:"host"`
	Port     int      `json:"port"`
	Username string   `json:"username"`
	Password string   `json:"password"`
	From     string   `json:"from"`
	To       []string `json:"to"`
	CC       []string `json:"cc,omitempty"`
	BCC      []string `json:"bcc,omitempty"`
	TLSMode  string   `json:"tls_mode,omitempty"` // none, starttls (default), smtps
}

type GoogleChatSender added in v1.2.0

type GoogleChatSender struct {
	AllowPrivate bool
}

func (*GoogleChatSender) Send added in v1.2.0

func (s *GoogleChatSender) Send(ctx context.Context, channel *storage.NotificationChannel, payload *Payload) error

func (*GoogleChatSender) Type added in v1.2.0

func (s *GoogleChatSender) Type() string

type GoogleChatSettings added in v1.2.0

type GoogleChatSettings struct {
	WebhookURL string `json:"webhook_url"`
}

type GotifySender added in v1.2.0

type GotifySender struct {
	AllowPrivate bool
}

func (*GotifySender) Send added in v1.2.0

func (s *GotifySender) Send(ctx context.Context, channel *storage.NotificationChannel, payload *Payload) error

func (*GotifySender) Type added in v1.2.0

func (s *GotifySender) Type() string

type GotifySettings added in v1.2.0

type GotifySettings struct {
	ServerURL string `json:"server_url"`
	AppToken  string `json:"app_token"`
	Priority  int    `json:"priority,omitempty"`
}

type MatrixSender added in v1.2.0

type MatrixSender struct {
	AllowPrivate bool
}

func (*MatrixSender) Send added in v1.2.0

func (s *MatrixSender) Send(ctx context.Context, channel *storage.NotificationChannel, payload *Payload) error

func (*MatrixSender) Type added in v1.2.0

func (s *MatrixSender) Type() string

type MatrixSettings added in v1.2.0

type MatrixSettings struct {
	Homeserver  string `json:"homeserver"`
	AccessToken string `json:"access_token"`
	RoomID      string `json:"room_id"`
}

type NtfySender

type NtfySender struct {
	AllowPrivate bool
}

func (*NtfySender) Send

func (s *NtfySender) Send(ctx context.Context, channel *storage.NotificationChannel, payload *Payload) error

func (*NtfySender) Type

func (s *NtfySender) Type() string

type NtfySettings

type NtfySettings struct {
	ServerURL string `json:"server_url"`
	Topic     string `json:"topic"`
	Priority  int    `json:"priority,omitempty"`
	Tags      string `json:"tags,omitempty"`
	ClickURL  string `json:"click_url,omitempty"`
}

type OpsgenieSender added in v1.2.0

type OpsgenieSender struct{}

func (*OpsgenieSender) Send added in v1.2.0

func (s *OpsgenieSender) Send(ctx context.Context, channel *storage.NotificationChannel, payload *Payload) error

func (*OpsgenieSender) Type added in v1.2.0

func (s *OpsgenieSender) Type() string

type OpsgenieSettings added in v1.2.0

type OpsgenieSettings struct {
	APIKey string `json:"api_key"`
	Region string `json:"region,omitempty"`
}

type PagerDutySender added in v1.2.0

type PagerDutySender struct{}

func (*PagerDutySender) Send added in v1.2.0

func (s *PagerDutySender) Send(ctx context.Context, channel *storage.NotificationChannel, payload *Payload) error

func (*PagerDutySender) Type added in v1.2.0

func (s *PagerDutySender) Type() string

type PagerDutySettings added in v1.2.0

type PagerDutySettings struct {
	RoutingKey string `json:"routing_key"`
}

type Payload

type Payload struct {
	EventType       string                 `json:"event_type"`
	Incident        *storage.Incident      `json:"incident,omitempty"`
	Monitor         *storage.Monitor       `json:"monitor,omitempty"`
	Change          *storage.ContentChange `json:"change,omitempty"`
	EscalationStep  int                    `json:"escalation_step,omitempty"`
	EscalationTotal int                    `json:"escalation_total,omitempty"`
}

Payload contains the notification data.

type PushoverSender added in v1.2.0

type PushoverSender struct{}

func (*PushoverSender) Send added in v1.2.0

func (s *PushoverSender) Send(ctx context.Context, channel *storage.NotificationChannel, payload *Payload) error

func (*PushoverSender) Type added in v1.2.0

func (s *PushoverSender) Type() string

type PushoverSettings added in v1.2.0

type PushoverSettings struct {
	UserKey  string `json:"user_key"`
	AppToken string `json:"app_token"`
	Priority int    `json:"priority,omitempty"`
	Sound    string `json:"sound,omitempty"`
	Device   string `json:"device,omitempty"`
}

type Sender

type Sender interface {
	Type() string
	Send(ctx context.Context, channel *storage.NotificationChannel, payload *Payload) error
}

Sender sends a notification via a specific channel type.

type SlackSender

type SlackSender struct {
	AllowPrivate bool
}

func (*SlackSender) Send

func (s *SlackSender) Send(ctx context.Context, channel *storage.NotificationChannel, payload *Payload) error

func (*SlackSender) Type

func (s *SlackSender) Type() string

type SlackSettings

type SlackSettings struct {
	WebhookURL string `json:"webhook_url"`
	Channel    string `json:"channel,omitempty"`
}

type SubscriberEvent added in v1.2.0

type SubscriberEvent struct {
	Event      string `json:"event"`
	StatusPage struct {
		ID    int64  `json:"id"`
		Title string `json:"title"`
		Slug  string `json:"slug"`
	} `json:"status_page"`
	Monitor  *subscriberMonitor  `json:"monitor,omitempty"`
	Incident *subscriberIncident `json:"incident,omitempty"`
	Time     string              `json:"timestamp"`
}

type SubscriberNotifier added in v1.2.0

type SubscriberNotifier struct {
	// contains filtered or unexported fields
}

func NewSubscriberNotifier added in v1.2.0

func NewSubscriberNotifier(store storage.Store, smtpCfg config.SMTPConfig, extURL string, logger *slog.Logger, allowPrivate bool) *SubscriberNotifier

func (*SubscriberNotifier) NotifyForMonitor added in v1.2.0

func (n *SubscriberNotifier) NotifyForMonitor(ctx context.Context, monitorID int64, eventType string, inc *storage.Incident, mon *storage.Monitor)

func (*SubscriberNotifier) SendConfirmationEmail added in v1.2.0

func (n *SubscriberNotifier) SendConfirmationEmail(ctx context.Context, sub *storage.StatusPageSubscriber, sp *storage.StatusPage) error

type TeamsSender added in v1.2.0

type TeamsSender struct {
	AllowPrivate bool
}

func (*TeamsSender) Send added in v1.2.0

func (s *TeamsSender) Send(ctx context.Context, channel *storage.NotificationChannel, payload *Payload) error

func (*TeamsSender) Type added in v1.2.0

func (s *TeamsSender) Type() string

type TeamsSettings added in v1.2.0

type TeamsSettings struct {
	WebhookURL string `json:"webhook_url"`
}

type TelegramSender

type TelegramSender struct{}

func (*TelegramSender) Send

func (s *TelegramSender) Send(ctx context.Context, channel *storage.NotificationChannel, payload *Payload) error

func (*TelegramSender) Type

func (s *TelegramSender) Type() string

type TelegramSettings

type TelegramSettings struct {
	BotToken string `json:"bot_token"`
	ChatID   string `json:"chat_id"`
}

type WebhookSender

type WebhookSender struct {
	AllowPrivate bool
}

func (*WebhookSender) Send

func (s *WebhookSender) Send(ctx context.Context, channel *storage.NotificationChannel, payload *Payload) error

func (*WebhookSender) Type

func (s *WebhookSender) Type() string

type WebhookSettings

type WebhookSettings struct {
	URL    string `json:"url"`
	Secret string `json:"secret,omitempty"` // HMAC-SHA256 signing secret
}

WebhookSettings holds webhook-specific configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL