Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultTelegramParseMode = "HTML"
View Source
const FullValidConfigForTesting = `` /* 196-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 = `{
"bottoken": "test-secret-token"
}`
FullValidSecretsForTesting is a string representation of JSON object that contains all fields that can be overridden from secrets
Variables ¶
View Source
var (
// APIURL of where the notification payload is sent. It is public to be overridable in integration tests.
APIURL = "https://api.telegram.org/bot%s/%s"
)
View Source
var SupportedParseMode = map[string]string{"Markdown": "Markdown", "MarkdownV2": "MarkdownV2", DefaultTelegramParseMode: "HTML", "None": ""}
SupportedParseMode is a map of all supported values for field `parse_mode`. https://core.telegram.org/bots/api#formatting-options. Keys are options accepted by Grafana API, values are options accepted by Telegram API
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { BotToken string `json:"bottoken,omitempty" yaml:"bottoken,omitempty"` ChatID string `json:"chatid,omitempty" yaml:"chatid,omitempty"` Message string `json:"message,omitempty" yaml:"message,omitempty"` ParseMode string `json:"parse_mode,omitempty" yaml:"parse_mode,omitempty"` DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty" yaml:"disable_web_page_preview,omitempty"` ProtectContent bool `json:"protect_content,omitempty" yaml:"protect_content,omitempty"` DisableNotifications bool `json:"disable_notifications,omitempty" yaml:"disable_notifications,omitempty"` }
func NewConfig ¶
func NewConfig(jsonData json.RawMessage, decryptFn receivers.DecryptFunc) (Config, error)
type Notifier ¶
Notifier is responsible for sending alert notifications to Telegram.
func New ¶
func New(cfg Config, meta receivers.Metadata, template *templates.Template, sender receivers.WebhookSender, images images.Provider, logger logging.Logger) *Notifier
New is the constructor for the Telegram notifier
func (*Notifier) SendResolved ¶
Click to show internal directories.
Click to hide internal directories.