notifications

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAutoHealNotificationMessage

func BuildAutoHealNotificationMessage(format MessageFormat, environmentName, containerName string) string

func BuildBatchImageUpdateNotificationMessage

func BuildBatchImageUpdateNotificationMessage(format MessageFormat, environmentName string, updates map[string]*imageupdate.Response) string

func BuildContainerUpdateNotificationMessage

func BuildContainerUpdateNotificationMessage(format MessageFormat, environmentName, containerName, imageRef, oldDigest, newDigest string) string

func BuildDiscordURL

func BuildDiscordURL(config models.DiscordConfig) (string, error)

BuildDiscordURL converts DiscordConfig to Shoutrrr URL format using shoutrrr's Config

func BuildEmailSubject

func BuildEmailSubject(environmentName, subject string) string

func BuildGenericURL

func BuildGenericURL(config models.GenericConfig) (string, error)

BuildGenericURL converts GenericConfig to Shoutrrr URL format for generic webhooks

func BuildGotifyURL

func BuildGotifyURL(config models.GotifyConfig) (string, error)

BuildGotifyURL converts GotifyConfig to Shoutrrr URL format URL example: gotify://host[:port][/path]/token[?query]

func BuildImageUpdateNotificationMessage

func BuildImageUpdateNotificationMessage(format MessageFormat, environmentName, imageRef string, updateInfo *imageupdate.Response) string

func BuildMatrixURL

func BuildMatrixURL(config models.MatrixConfig) (string, error)

BuildMatrixURL converts MatrixConfig to Shoutrrr URL format URL example: matrix://user:password@host[:port]/[?rooms=!roomID1[,roomAlias2]][&disableTLS=yes]

func BuildNtfyURL

func BuildNtfyURL(config models.NtfyConfig) (string, error)

BuildNtfyURL converts NtfyConfig to Shoutrrr URL format URL example: ntfy://[user:password@]host[:port]/topic[?query]

func BuildPruneReportNotificationMessage

func BuildPruneReportNotificationMessage(format MessageFormat, environmentName string, result *system.PruneAllResult) string

func BuildPushoverURL

func BuildPushoverURL(config models.PushoverConfig) (string, error)

BuildPushoverURL converts PushoverConfig to Shoutrrr URL format. URL example: pushover://:token@user?devices=device1,device2&priority=1&title=Container+Update

func BuildSignalURL

func BuildSignalURL(config models.SignalConfig) (string, error)

BuildSignalURL converts SignalConfig to Shoutrrr URL format using shoutrrr's Config

func BuildSlackURL

func BuildSlackURL(config models.SlackConfig) (string, error)

BuildSlackURL converts SlackConfig to Shoutrrr URL format using shoutrrr's Config

func BuildTelegramURL

func BuildTelegramURL(config models.TelegramConfig) (string, error)

BuildTelegramURL converts TelegramConfig to Shoutrrr URL format using shoutrrr's Config

func BuildVulnerabilitySummaryNotificationMessage

func BuildVulnerabilitySummaryNotificationMessage(format MessageFormat, environmentName, summaryLabel, overview, fixableCount, severityBreakdown, sampleCVEs string) string

func DecodeConfig added in v2.1.0

func DecodeConfig[T any](config models.JSON, providerName string) (T, error)

DecodeConfig round-trips a provider config (models.JSON) into a typed struct T.

func DecryptStringCredential added in v2.1.0

func DecryptStringCredential(value *string) error

DecryptStringCredential decrypts an encrypted credential in place. A value that fails to decrypt but is not plausibly ciphertext is treated as a legacy raw value.

func Deliver added in v2.3.2

func Deliver(ctx context.Context, provider models.NotificationProvider, config models.JSON, c Content) (handled bool, err error)

Deliver sends c to a single provider. handled is false for unknown providers.

func FormatBytes

func FormatBytes(bytes uint64) string

func PrepareGotifyConfig added in v2.1.0

func PrepareGotifyConfig(config models.JSON, providerName string) (models.GotifyConfig, error)

PrepareGotifyConfig decodes and decrypts a Gotify provider config.

func PrepareMatrixConfig added in v2.1.0

func PrepareMatrixConfig(config models.JSON) (models.MatrixConfig, error)

PrepareMatrixConfig decodes and decrypts a Matrix provider config.

func PrepareNtfyConfig added in v2.1.0

func PrepareNtfyConfig(config models.JSON, providerName string, requireTopic bool) (models.NtfyConfig, error)

PrepareNtfyConfig decodes and decrypts an ntfy provider config.

func PreparePushoverConfig added in v2.1.0

func PreparePushoverConfig(config models.JSON, providerName string) (models.PushoverConfig, error)

PreparePushoverConfig decodes and decrypts a Pushover provider config.

func PrepareSlackConfig added in v2.1.0

func PrepareSlackConfig(config models.JSON, providerName string, requireToken bool) (models.SlackConfig, error)

PrepareSlackConfig decodes and decrypts a Slack provider config.

func SanitizeForEmail

func SanitizeForEmail(text string) string

SanitizeForEmail sanitizes text for safe use in email subjects

func SendDiscord

func SendDiscord(ctx context.Context, config models.DiscordConfig, message string) error

SendDiscord sends a message via Shoutrrr Discord using proper service configuration

func SendEmail

func SendEmail(ctx context.Context, config models.EmailConfig, subject, htmlBody string) error

SendEmail sends pre-rendered HTML via go-mail.

func SendGenericWithTitle

func SendGenericWithTitle(ctx context.Context, config models.GenericConfig, title, message string) error

SendGenericWithTitle sends a message with title via Shoutrrr Generic webhook. When config.SuccessBodyContains is set the response body is also inspected — this is necessary for providers (e.g. PushPlus) that always return HTTP 200 but embed a success/failure indicator inside the JSON body.

func SendGotify

func SendGotify(ctx context.Context, config models.GotifyConfig, message string) error

SendGotify sends a message via Shoutrrr Gotify using proper service configuration

func SendMatrix

func SendMatrix(ctx context.Context, config models.MatrixConfig, message string) error

SendMatrix sends a message via Shoutrrr Matrix using proper service configuration

func SendNtfy

func SendNtfy(ctx context.Context, config models.NtfyConfig, message string) error

SendNtfy sends a message via Shoutrrr Ntfy using proper service configuration

func SendPushover

func SendPushover(ctx context.Context, config models.PushoverConfig, message string) error

SendPushover sends a message via Shoutrrr Pushover using proper service configuration.

func SendSignal

func SendSignal(ctx context.Context, config models.SignalConfig, message string) error

SendSignal sends a message via Shoutrrr Signal using proper service configuration

func SendSlack

func SendSlack(ctx context.Context, config models.SlackConfig, message string) error

SendSlack sends a message via Shoutrrr Slack using proper service configuration

func SendTelegram

func SendTelegram(ctx context.Context, config models.TelegramConfig, message string) error

SendTelegram sends a message via Shoutrrr Telegram using proper service configuration

func TextByFormat added in v2.3.2

func TextByFormat(build func(MessageFormat) string) map[MessageFormat]string

TextByFormat builds the per-format message map for Content.Text from a single messages.go builder closure.

Types

type Content added in v2.3.2

type Content struct {
	// Text holds the message body per format, built once per fan-out via the
	// messages.go builders.
	Text map[MessageFormat]string

	// Title is the generic-webhook title.
	Title string

	// DefaultTitle is applied to pushover/gotify when their config has no
	// title; "" means don't default.
	DefaultTitle string

	// RenderEmail lazily renders the email subject and HTML body. Built as a
	// closure by the caller so template resources and app config stay out of
	// this package. Nil means the provider map's email deliverer errors.
	RenderEmail func() (subject, html string, err error)

	// RequireNtfyTopic preserves the per-event ntfy topic validation.
	RequireNtfyTopic bool

	// ValidatePushoverUser preserves the per-event pushover token/user validation.
	ValidatePushoverUser bool
}

Content is the provider-independent description of one notification: the message text per format plus the per-event knobs that vary between events.

type MessageFormat

type MessageFormat string
const (
	MessageFormatPlain    MessageFormat = "plain"
	MessageFormatMarkdown MessageFormat = "markdown"
	MessageFormatSlack    MessageFormat = "slack"
	MessageFormatHTML     MessageFormat = "html"
)

Jump to

Keyboard shortcuts

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