notify

package
v0.92.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package notify provides the notification dispatcher interface and registry.

Index

Constants

View Source
const (
	// PayloadKeySummary is the key in the GatewaySend payload map for the summary text.
	PayloadKeySummary = "summary"
)

Variables

This section is empty.

Functions

func ChannelSend deprecated added in v0.21.1

func ChannelSend(ctx context.Context, uid types.Uid, name string, message Message) error

Deprecated: Use GatewaySend with a "notify.test" template for internal/debug notification sends. ChannelSend bypasses the template engine and rule engine; kept for legacy support.

func GatewaySend added in v0.92.0

func GatewaySend(ctx context.Context, uid types.Uid, templateID string, channels []string, payload map[string]any) error

GatewaySend is the central notification gateway entry point. It renders a notification template and dispatches the message to the specified channels. If uid is not zero, it looks up the user's channel configuration from the store. Rules (throttle, mute, aggregate) are applied before sending (when rule engine is initialized).

func GetNotifyStore added in v0.92.0

func GetNotifyStore() *store.NotifyStore

GetNotifyStore returns the NotifyStore from the global database adapter, or nil if the store is not available.

func List

func List() map[string]Notifyer

func ParseSchema

func ParseSchema(testString string) (string, error)

func ParseTemplate

func ParseTemplate(testString string, templates []string) (types.KV, error)

func Register

func Register(id string, notifyer Notifyer)

func Send

func Send(text string, message Message) error

Types

type Message

type Message struct {
	Title    string
	Body     string
	Url      string
	Priority Priority
}

type Notifyer

type Notifyer interface {
	// Protocol Define protocol
	Protocol() string
	// Templates Define object templates
	Templates() []string
	// Send notify
	Send(tokens types.KV, message Message) error
}

type Priority

type Priority int32
const (
	Low Priority = iota + 1
	Moderate
	Normal
	High
	Emergency
)

Directories

Path Synopsis
Package messagepusher implements the Message Pusher notification provider.
Package messagepusher implements the Message Pusher notification provider.
Package ntfy implements the ntfy notification provider.
Package ntfy implements the ntfy notification provider.
Package pushover implements Pushover notification provider.
Package pushover implements Pushover notification provider.
Package rules provides the notification rule engine for throttling, aggregation, and mute/DND.
Package rules provides the notification rule engine for throttling, aggregation, and mute/DND.
Package slack implements the Slack notification provider.
Package slack implements the Slack notification provider.
Package template provides notification template rendering using Go text/template with Sprig function library support.
Package template provides notification template rendering using Go text/template with Sprig function library support.

Jump to

Keyboard shortcuts

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