Help us shape the future of Go! Take the 2026 Go Developer Survey

telegram

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTelegramConfig = TelegramConfig{
	NotifierConfig: amcommoncfg.NotifierConfig{
		VSendResolved: true,
	},
	DisableNotifications: false,
	Message:              `{{ template "telegram.default.message" . }}`,
	ParseMode:            "HTML",
}

Functions

This section is empty.

Types

type Notifier

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

Notifier implements a Notifier for telegram notifications.

func New

New returns a new Telegram notification handler.

func (*Notifier) Notify

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

type TelegramConfig added in v0.34.0

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

	HTTPConfig *commoncfg.HTTPClientConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"`

	APIUrl               *amcommoncfg.URL `yaml:"api_url" json:"api_url,omitempty"`
	BotToken             commoncfg.Secret `yaml:"bot_token,omitempty" json:"token,omitempty"`
	BotTokenFile         string           `yaml:"bot_token_file,omitempty" json:"token_file,omitempty"`
	ChatID               int64            `yaml:"chat_id,omitempty" json:"chat,omitempty"`
	ChatIDFile           string           `yaml:"chat_id_file,omitempty" json:"chat_file,omitempty"`
	MessageThreadID      int              `yaml:"message_thread_id,omitempty" json:"message_thread_id,omitempty"`
	Message              string           `yaml:"message,omitempty" json:"message,omitempty"`
	DisableNotifications bool             `yaml:"disable_notifications,omitempty" json:"disable_notifications,omitempty"`
	ParseMode            string           `yaml:"parse_mode,omitempty" json:"parse_mode,omitempty"`
}

TelegramConfig configures notifications via Telegram.

func (*TelegramConfig) UnmarshalYAML added in v0.34.0

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

UnmarshalYAML implements the yaml.Unmarshaler interface.

Jump to

Keyboard shortcuts

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