slack

package
v1.32.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Type   string `json:"type"`
	Text   *Text  `json:"text,omitempty"`
	Fields []Text `json:"fields,omitempty"`
}

Block represents a block in a Slack message.

type Message

type Message struct {
	Text   string  `json:"text"`
	Blocks []Block `json:"blocks"`
}

Message represents a Slack Block Kit message.

func NewMessage

func NewMessage(text string) *Message

NewMessage creates an empty Slack message with fallback notification text.

func (*Message) AddFields

func (m *Message) AddFields(fields ...string)

AddFields appends a section containing Markdown fields.

func (*Message) AddHeader

func (m *Message) AddHeader(text string)

AddHeader appends a plain-text header block.

func (*Message) AddSection

func (m *Message) AddSection(text string)

AddSection appends a Markdown section block.

func (*Message) RenderMarkdown

func (m *Message) RenderMarkdown() string

RenderMarkdown renders the message blocks as Markdown.

func (*Message) Send

func (m *Message) Send(webhookURL string) (retErr error)

Send posts the message to a Slack webhook.

type Text

type Text struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

Text represents text content in a Slack block.

Jump to

Keyboard shortcuts

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