Documentation
¶
Index ¶
- Constants
- type Config
- func (c Config) GetChannel(inherited ...string) string
- func (c Config) GetIconEmoji(inherited ...string) string
- func (c Config) GetIconURL(inherited ...string) string
- func (c Config) GetUsername(inherited ...string) string
- func (c Config) GetWebhook(defaults ...string) string
- func (c Config) IsZero() bool
- type Message
- type MessageAttachment
- type MessageAttachmentField
- type WebhookSender
Constants ¶
View Source
const (
// ErrNon200 is the exception class when a non-200 is returned from slack.
ErrNon200 = "slack; non-200 status code returned from remote"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Username string `json:"username,omitempty" yaml:"username,omitempty"`
Channel string `json:"channel,omitempty" yaml:"channel,omitempty"`
IconURL string `json:"iconURL,omitempty" yaml:"iconURL,omitempty"`
IconEmoji string `json:"iconEmoji,omitempty" yaml:"iconEmoji,omitempty"`
Webhook string `json:"webhook,omitempty" yaml:"webhook,omitempty"`
}
Config represents the required fields for the config.
func (Config) GetChannel ¶
GetChannel returns a property or default.
func (Config) GetIconEmoji ¶
GetIconEmoji returns a property or default.
func (Config) GetIconURL ¶
GetIconURL returns a property or default.
func (Config) GetUsername ¶
GetUsername returns a property or a default.
func (Config) GetWebhook ¶
GetWebhook returns the webhook url.
type Message ¶
type Message struct {
Channel string `json:"channel,omitempty"`
ResponseType string `json:"response_type,omitempty"`
Text string `json:"text"`
Username string `json:"username,omitempty"`
UnfurlLinks bool `json:"unfurl_links"`
IconEmoji string `json:"icon_emoji,omitempty"`
IconURL string `json:"icon_url,omitempty"`
Attachments []MessageAttachment `json:"attachments"`
}
Message is a message sent to slack.
type MessageAttachment ¶
type MessageAttachment struct {
Title string `json:"title,omitempty"`
Color string `json:"color,omitempty"`
Pretext string `json:"pretext,omitempty"`
Text string `json:"text,omitempty"`
MarkdownIn []string `json:"mrkdwn_in,omitempty"`
Fields []MessageAttachmentField `json:"fields,omitempty"`
}
MessageAttachment is an attachment for a message.
type MessageAttachmentField ¶
type MessageAttachmentField struct {
Title string `json:"title,omitempty"`
Value string `json:"value,omitempty"`
Short bool `json:"short"`
}
MessageAttachmentField is a field on an attachment.
type WebhookSender ¶
type WebhookSender struct {
*webutil.RequestSender
Config *Config
}
WebhookSender sends slack webhooks.
func NewWebhookSender ¶
func NewWebhookSender(cfg *Config) *WebhookSender
NewWebhookSender creates a new webhook sender.
func (WebhookSender) ApplyDefaults ¶
func (whs WebhookSender) ApplyDefaults(message Message) Message
ApplyDefaults applies defaults.
func (WebhookSender) Send ¶
func (whs WebhookSender) Send(message Message) error
Send sends a slack hook.
Click to show internal directories.
Click to hide internal directories.