Documentation
¶
Overview ¶
slackhook is a minimal client for Slack's Incoming WebHooks API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
Type string `json:"type,omitempty"`
Text string `json:"text,omitempty"`
URL string `json:"url,omitempty"`
Style string `json:"style,omitempty"`
}
Action is a link styled as a button
See https://api.slack.com/docs/message-attachments#attaching_buttons_to_messages
type Attachment ¶
type Attachment struct {
Fallback string `json:"fallback,omitempty"` // plain text summary
Color string `json:"color,omitempty"` // {good|warning|danger|hex}
AuthorName string `json:"author_name,omitempty"`
AuthorLink string `json:"author_link,omitempty"`
AuthorIcon string `json:"author_icon,omitempty"`
Title string `json:"title,omitempty"` // larger, bold text at top of attachment
TitleLink string `json:"title_link,omitempty"`
Text string `json:"text,omitempty"`
Fields []Field `json:"fields,omitempty"`
Actions []Action `json:"actions,omitempty"`
ImageURL string `json:"image_url,omitempty"`
ThumbURL string `json:"thumb_url,omitempty"`
Timestamp int `json:"ts,omitempty"` // Unix timestamp
}
Attachment provides rich-formatting to messages
type Client ¶
type Client struct {
HTTPClient Poster
// contains filtered or unexported fields
}
Client for Slack's Incoming WebHook API.
func New ¶
func New(url string, opts ClientOptions) *Client
New Slack Incoming WebHook Client using http.DefaultClient for its Poster.
type ClientOptions ¶
type ClientOptions struct {
HTTPClient Poster
}
ClientOptions specifies options when creating a new Client
type Field ¶
type Field struct {
Title string `json:"title,omitempty"`
Value string `json:"value,omitempty"`
Short bool `json:"short,omitempty"`
}
Field is displayed in a table inside the message attachment
type Message ¶
type Message struct {
Text string `json:"text"`
Channel string `json:"channel,omitempty"`
UserName string `json:"username,omitempty"`
IconURL string `json:"icon_url,omitempty"`
IconEmoji string `json:"icon_emoji,omitempty"`
Attachments []*Attachment `json:"attachments,omitempty"`
}
Message to send to Slack's Incoming WebHook API.
See https://api.slack.com/incoming-webhooks
func (*Message) AddAttachment ¶
func (m *Message) AddAttachment(a *Attachment)
AddAttachment adds attachments to a Slack Message
Click to show internal directories.
Click to hide internal directories.
