mattermost

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMattermostConfig = MattermostConfig{
	NotifierConfig: amcommoncfg.NotifierConfig{
		VSendResolved: true,
	},
	Username:  `{{ template "mattermost.default.username" . }}`,
	Color:     `{{ template "mattermost.default.color" . }}`,
	Text:      `{{ template "mattermost.default.text" . }}`,
	Title:     `{{ template "mattermost.default.title" . }}`,
	TitleLink: `{{ template "mattermost.default.titlelink" . }}`,
	Fallback:  `{{ template "mattermost.default.fallback" . }}`,
}

Functions

This section is empty.

Types

type MattermostAttachment added in v0.33.0

type MattermostAttachment struct {
	Fallback   string             `yaml:"fallback,omitempty" json:"fallback,omitempty"`
	Color      string             `yaml:"color,omitempty" json:"color,omitempty"`
	Pretext    string             `yaml:"pretext,omitempty" json:"pretext,omitempty"`
	Text       string             `yaml:"text,omitempty" json:"text,omitempty"`
	AuthorName string             `yaml:"author_name,omitempty" json:"author_name,omitempty"`
	AuthorLink string             `yaml:"author_link,omitempty" json:"author_link,omitempty"`
	AuthorIcon string             `yaml:"author_icon,omitempty" json:"author_icon,omitempty"`
	Title      string             `yaml:"title,omitempty" json:"title,omitempty"`
	TitleLink  string             `yaml:"title_link,omitempty" json:"title_link,omitempty"`
	Fields     []*MattermostField `yaml:"fields,omitempty" json:"fields,omitempty"`
	ThumbURL   string             `yaml:"thumb_url,omitempty" json:"thumb_url,omitempty"`
	Footer     string             `yaml:"footer,omitempty" json:"footer,omitempty"`
	FooterIcon string             `yaml:"footer_icon,omitempty" json:"footer_icon,omitempty"`
	ImageURL   string             `yaml:"image_url,omitempty" json:"image_url,omitempty"`
}

MattermostAttachment defines an attachment for a Mattermost notification. See https://developers.mattermost.com/integrate/reference/message-attachments/#fields for more information.

type MattermostConfig added in v0.33.0

type MattermostConfig struct {
	amcommoncfg.NotifierConfig `yaml:",inline" json:",inline"`

	HTTPConfig     *commoncfg.HTTPClientConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"`
	WebhookURL     *amcommoncfg.SecretURL      `yaml:"webhook_url,omitempty" json:"webhook_url,omitempty"`
	WebhookURLFile string                      `yaml:"webhook_url_file,omitempty" json:"webhook_url_file,omitempty"`

	Channel  string `yaml:"channel,omitempty" json:"channel,omitempty"`
	Username string `yaml:"username,omitempty" json:"username,omitempty"`

	Text        string                  `yaml:"text,omitempty" json:"text,omitempty"`
	Fallback    string                  `yaml:"fallback,omitempty" json:"fallback,omitempty"`
	Color       string                  `yaml:"color,omitempty" json:"color,omitempty"`
	Pretext     string                  `yaml:"pretext,omitempty" json:"pretext,omitempty"`
	AuthorName  string                  `yaml:"author_name,omitempty" json:"author_name,omitempty"`
	AuthorLink  string                  `yaml:"author_link,omitempty" json:"author_link,omitempty"`
	AuthorIcon  string                  `yaml:"author_icon,omitempty" json:"author_icon,omitempty"`
	Title       string                  `yaml:"title,omitempty" json:"title,omitempty"`
	TitleLink   string                  `yaml:"title_link,omitempty" json:"title_link,omitempty"`
	Fields      []*MattermostField      `yaml:"fields,omitempty" json:"fields,omitempty"`
	ThumbURL    string                  `yaml:"thumb_url,omitempty" json:"thumb_url,omitempty"`
	Footer      string                  `yaml:"footer,omitempty" json:"footer,omitempty"`
	FooterIcon  string                  `yaml:"footer_icon,omitempty" json:"footer_icon,omitempty"`
	ImageURL    string                  `yaml:"image_url,omitempty" json:"image_url,omitempty"`
	IconURL     string                  `yaml:"icon_url,omitempty" json:"icon_url,omitempty"`
	IconEmoji   string                  `yaml:"icon_emoji,omitempty" json:"icon_emoji,omitempty"`
	Attachments []*MattermostAttachment `yaml:"attachments,omitempty" json:"attachments,omitempty"`
	Type        string                  `yaml:"type,omitempty" json:"type,omitempty"`
	Props       *MattermostProps        `yaml:"props,omitempty" json:"props,omitempty"`
	Priority    *MattermostPriority     `yaml:"priority,omitempty" json:"priority,omitempty"`
}

MattermostConfig configures notifications via Mattermost. See https://developers.mattermost.com/integrate/webhooks/incoming/ for more information.

func (*MattermostConfig) UnmarshalYAML added in v0.33.0

func (c *MattermostConfig) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type MattermostField added in v0.33.0

type MattermostField struct {
	Title string `yaml:"title,omitempty" json:"title,omitempty"`
	Value string `yaml:"value,omitempty" json:"value,omitempty"`
	Short *bool  `yaml:"short,omitempty" json:"short,omitempty"`
}

MattermostField configures a single Mattermost field for Slack compatibility. See https://developers.mattermost.com/integrate/reference/message-attachments/#fields for more information.

func (*MattermostField) UnmarshalYAML added in v0.33.0

func (c *MattermostField) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface for MattermostField.

type MattermostPriority added in v0.33.0

type MattermostPriority struct {
	Priority                string `yaml:"priority,omitempty" json:"priority,omitempty"`
	RequestedAck            bool   `yaml:"requested_ack,omitempty" json:"requested_ack,omitempty"`
	PersistentNotifications bool   `yaml:"persistent_notifications,omitempty" json:"persistent_notifications,omitempty"`
}

MattermostPriority defines the priority for a mattermost notification.

type MattermostProps added in v0.33.0

type MattermostProps struct {
	Card string `yaml:"card,omitempty" json:"card,omitempty"`
}

MattermostProps defines additional properties for a mattermost notification. Only 'card' property takes effect now.

type Notifier

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

Notifier implements a Notifier for Mattermost notifications.

func New

New returns a new Mattermost notifier.

func (*Notifier) Notify

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

Notify implements the Notifier interface.

Jump to

Keyboard shortcuts

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