rocketchat

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ProcessingTypeSendMessage        = "sendMessage"
	ProcessingTypeRespondWithMessage = "respondWithMessage"
)

Variables

View Source
var DefaultRocketchatConfig = RocketchatConfig{
	NotifierConfig: amcommoncfg.NotifierConfig{
		VSendResolved: false,
	},
	Color:     `{{ if eq .Status "firing" }}red{{ else }}green{{ end }}`,
	Emoji:     `{{ template "rocketchat.default.emoji" . }}`,
	IconURL:   `{{ template "rocketchat.default.iconurl" . }}`,
	Text:      `{{ template "rocketchat.default.text" . }}`,
	Title:     `{{ template "rocketchat.default.title" . }}`,
	TitleLink: `{{ template "rocketchat.default.titlelink" . }}`,
}

DefaultRocketchatConfig defines default values for Rocketchat configurations.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Title     string                       `json:"title,omitempty"`
	TitleLink string                       `json:"title_link,omitempty"`
	Text      string                       `json:"text,omitempty"`
	ImageURL  string                       `json:"image_url,omitempty"`
	ThumbURL  string                       `json:"thumb_url,omitempty"`
	Color     string                       `json:"color,omitempty"`
	Fields    []RocketchatAttachmentField  `json:"fields,omitempty"`
	Actions   []RocketchatAttachmentAction `json:"actions,omitempty"`
}

PostMessage.Attachment Payload for postmessage rest API

https://developer.rocket.chat/apidocs/post-message

type Notifier

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

func New

New returns a new Rocketchat notification handler.

func (*Notifier) Notify

func (n *Notifier) Notify(ctx context.Context, as ...*alert.Alert) notify.NotifyVerdict

Notify implements the Notifier interface.

type PostMessage

type PostMessage struct {
	Channel     string                       `json:"channel,omitempty"`
	Text        string                       `json:"text,omitempty"`
	Alias       string                       `json:"alias,omitempty"`
	Emoji       string                       `json:"emoji,omitempty"`
	Avatar      string                       `json:"avatar,omitempty"`
	Attachments []Attachment                 `json:"attachments,omitempty"`
	Actions     []RocketchatAttachmentAction `json:"actions,omitempty"`
}

PostMessage Payload for postmessage rest API

https://developer.rocket.chat/apidocs/post-message

type RocketchatAttachmentAction added in v0.35.0

type RocketchatAttachmentAction struct {
	Type               string `json:"type,omitempty"`
	Text               string `json:"text,omitempty"`
	URL                string `json:"url,omitempty"`
	ImageURL           string `json:"image_url,omitempty"`
	IsWebView          bool   `json:"is_webview"`
	WebviewHeightRatio string `json:"webview_height_ratio,omitempty"`
	Msg                string `json:"msg,omitempty"`
	MsgInChatWindow    bool   `json:"msg_in_chat_window"`
	MsgProcessingType  string `json:"msg_processing_type,omitempty"`
}

type RocketchatAttachmentField added in v0.35.0

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

type RocketchatConfig added in v0.35.0

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

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

	APIURL      *amcommoncfg.URL  `yaml:"api_url,omitempty" json:"api_url,omitempty"`
	TokenID     *commoncfg.Secret `yaml:"token_id,omitempty" json:"token_id,omitempty"`
	TokenIDFile string            `yaml:"token_id_file,omitempty" json:"token_id_file,omitempty"`
	Token       *commoncfg.Secret `yaml:"token,omitempty" json:"token,omitempty"`
	TokenFile   string            `yaml:"token_file,omitempty" json:"token_file,omitempty"`

	// RocketChat channel override, (like #other-channel or @username).
	Channel string `yaml:"channel,omitempty" json:"channel,omitempty"`

	Color       string                        `yaml:"color,omitempty" json:"color,omitempty"`
	Title       string                        `yaml:"title,omitempty" json:"title,omitempty"`
	TitleLink   string                        `yaml:"title_link,omitempty" json:"title_link,omitempty"`
	Text        string                        `yaml:"text,omitempty" json:"text,omitempty"`
	MessageText string                        `yaml:"message_text,omitempty" json:"message_text,omitempty"`
	Fields      []*RocketchatAttachmentField  `yaml:"fields,omitempty" json:"fields,omitempty"`
	ShortFields bool                          `yaml:"short_fields" json:"short_fields,omitempty"`
	Emoji       string                        `yaml:"emoji,omitempty" json:"emoji,omitempty"`
	IconURL     string                        `yaml:"icon_url,omitempty" json:"icon_url,omitempty"`
	ImageURL    string                        `yaml:"image_url,omitempty" json:"image_url,omitempty"`
	ThumbURL    string                        `yaml:"thumb_url,omitempty" json:"thumb_url,omitempty"`
	LinkNames   bool                          `yaml:"link_names" json:"link_names,omitempty"`
	Actions     []*RocketchatAttachmentAction `yaml:"actions,omitempty" json:"actions,omitempty"`
}

RocketchatConfig configures notifications via Rocketchat.

func (*RocketchatConfig) UnmarshalYAML added in v0.35.0

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

UnmarshalYAML implements the yaml.Unmarshaler interface.

func (*RocketchatConfig) Validate added in v0.35.0

func (c *RocketchatConfig) Validate() error

Validate checks the RocketchatConfig for correctness.

Jump to

Keyboard shortcuts

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