Documentation
¶
Index ¶
Constants ¶
View Source
const MockClient = "slack://mock"
Magic URL to use a mock client in dev.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Attachment ¶
type Attachment struct {
Pretext string `json:"pretext,omitempty"`
Fallback string `json:"fallback"`
Color string `json:"color,omitempty"`
Title string `json:"title,omitempty"`
TitleLink string `json:"title_link,omitempty"`
Text string `json:"text,omitempty"`
TimeStamp int64 `json:"ts,omitempty"`
Fields []Field `json:"fields,omitempty"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client posts messages to a Slack webhook URL.
func (*Client) Post ¶
Post message to Slack. Logger must not be nil. Uses http.DefaultClient if cl is nil. Returns an error if response is not 200 OK.
func (*Client) Set ¶ added in v0.20.2
Set the hookURL for a Client. If hookURL is MockClient, Client will use a mock client. Set is part of the flag.Value interface.
type Logger ¶ added in v0.23.2
Logger is any function that behaves like slog.InfoContext, slog.DebugContext, etc.
type Message ¶
type Message struct {
Text string `json:"text"`
Attachments []Attachment `json:"attachments"`
}
Message is the JSON object expected by Slack
Click to show internal directories.
Click to hide internal directories.