v1

package
v0.0.0-release-12.4.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const FullValidConfigForTesting = `` /* 245-byte string literal not displayed */

FullValidConfigForTesting is a string representation of a JSON object that contains all fields supported by the notifier Config. It can be used without secrets.

View Source
const FullValidSecretsForTesting = `{
	"username": "test-secret-user",
	"password": "test-secret-pass"
}`

FullValidSecretsForTesting is a string representation of JSON object that contains all fields that can be overridden from secrets

View Source
const Version = schema.V1

Variables

View Source
var Schema = schema.IntegrationSchemaVersion{
	Version:   Version,
	CanCreate: true,
	Options: []schema.Field{
		{
			Label:        "URL",
			Element:      schema.ElementTypeInput,
			InputType:    schema.InputTypeText,
			PropertyName: "url",
			Required:     true,
			Protected:    true,
		},
		{
			Label:   "HTTP Method",
			Element: schema.ElementTypeSelect,
			SelectOptions: []schema.SelectOption{
				{
					Value: "POST",
					Label: "POST",
				},
				{
					Value: "PUT",
					Label: "PUT",
				},
			},
			PropertyName: "httpMethod",
		},
		{
			Label:        "HTTP Basic Authentication - Username",
			Element:      schema.ElementTypeInput,
			InputType:    schema.InputTypeText,
			PropertyName: "username",
		},
		{
			Label:        "HTTP Basic Authentication - Password",
			Element:      schema.ElementTypeInput,
			InputType:    schema.InputTypePassword,
			PropertyName: "password",
			Secure:       true,
		},
		{
			Label:        "Authorization Header - Scheme",
			Description:  "Optionally provide a scheme for the Authorization Request Header. Default is Bearer.",
			Element:      schema.ElementTypeInput,
			InputType:    schema.InputTypeText,
			PropertyName: "authorization_scheme",
			Placeholder:  "Bearer",
		},
		{
			Label:        "Authorization Header - Credentials",
			Description:  "Credentials for the Authorization Request header. Only one of HTTP Basic Authentication or Authorization Request Header can be set.",
			Element:      schema.ElementTypeInput,
			InputType:    schema.InputTypeText,
			PropertyName: "authorization_credentials",
			Secure:       true,
		},
		{
			Label:        "Max Alerts",
			Description:  "Max alerts to include in a notification. Remaining alerts in the same batch will be ignored above this number. 0 means no limit.",
			Element:      schema.ElementTypeInput,
			InputType:    schema.InputTypeText,
			PropertyName: "maxAlerts",
		},
		{
			Label:        "Title",
			Description:  "Templated title of the message.",
			Element:      schema.ElementTypeTextArea,
			InputType:    schema.InputTypeText,
			PropertyName: "title",
			Placeholder:  templates.DefaultMessageTitleEmbed,
		},
		{
			Label:        "Message",
			Description:  "Custom message. You can use template variables.",
			Element:      schema.ElementTypeTextArea,
			PropertyName: "message",
			Placeholder:  templates.DefaultMessageEmbed,
		},
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	URL        string
	HTTPMethod string
	MaxAlerts  int
	// Authorization Header.
	AuthorizationScheme      string
	AuthorizationCredentials string
	// HTTP Basic Authentication.
	User     string
	Password string

	Title   string
	Message string
}

func NewConfig

func NewConfig(jsonData json.RawMessage, decryptFn receivers.DecryptFunc) (Config, error)

type Notifier

type Notifier struct {
	*receivers.Base
	// contains filtered or unexported fields
}

Notifier is responsible for sending alert notifications as webhooks.

func New

func New(cfg Config, meta receivers.Metadata, template *templates.Template, sender receivers.WebhookSender, images images.Provider, logger log.Logger, orgID int64) *Notifier

New is the constructor for the WebHook notifier.

func (*Notifier) Notify

func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)

Notify implements the Notifier interface.

func (*Notifier) SendResolved

func (n *Notifier) SendResolved() bool

Jump to

Keyboard shortcuts

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