slack

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package slack is a Slack incoming-webhook sink. One webhook URL per channel — the publisher picks the right sink instance for the channel it wants to post to.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	WebhookURL string
	HTTPClient *http.Client // optional; nil uses http.DefaultClient
}

Config holds the per-channel webhook URL.

type Recipient

type Recipient struct{}

Recipient is unused but kept to satisfy the typed-recipient pattern; the channel is determined by the webhook URL itself. Callers may pass nil.

type Sink

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

Sink posts to the configured Slack webhook URL.

func New

func New(cfg Config) (*Sink, error)

New constructs a Sink. Returns a coded error if WebhookURL is empty.

func NewNamed

func NewNamed(name string, cfg Config) (*Sink, error)

NewNamed constructs a Sink with a custom name. Used by the factory.

func (*Sink) DecodeRecipient

func (s *Sink) DecodeRecipient(_ []byte) (sinks.Recipient, error)

DecodeRecipient is a no-op for slack — the channel is fixed by the webhook URL, so Recipient is always the zero value.

func (*Sink) Name

func (s *Sink) Name() string

Name returns the registry key.

func (*Sink) Send

func (s *Sink) Send(ctx context.Context, _ sinks.Recipient, m sinks.Message) error

Send posts the message to Slack. The Recipient is ignored; the channel is fixed by the webhook URL.

Jump to

Keyboard shortcuts

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