slack

package
v0.85.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package slack provides reference hook implementations that post notifications to Slack via the Slack Bot API using Block Kit formatting inside colored attachments.

The bot token is read from the SLACK_BOT_TOKEN environment variable at execution time. All hooks use changeset.Warn failure policy so Slack errors never block the changeset pipeline. When the token is empty the hooks log a warning and no-op, making them safe to register unconditionally.

Usage:

Configure(myCS).With(cfg).
    WithPreHooks(slack.Notify(channel, "deploying tokens")).
    WithPostHooks(slack.Result(channel))

Index

Constants

View Source
const (

	// TokenEnvVar is the environment variable name read at hook execution time.
	TokenEnvVar = "SLACK_BOT_TOKEN" //nolint:gosec // env var name, not a credential

)

Variables

This section is empty.

Functions

func Notify

func Notify(channel, message string) changeset.PreHook

Notify returns a PreHook that posts a Block Kit message to channel using the Slack chat.postMessage API. The bot token is read from SLACK_BOT_TOKEN at execution time. Messages render with a blue color bar and structured fields. Uses Warn policy with a 10s timeout. No-ops when the env var is empty.

func Result

func Result(channel string) changeset.PostHook

Result returns a PostHook that posts changeset success/failure status to channel using the Slack chat.postMessage API with Block Kit formatting. The bot token is read from SLACK_BOT_TOKEN at execution time. Success renders with a green color bar, failure with red. Uses Warn policy with a 10s timeout. No-ops when the env var is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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