slacknotify

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package slacknotify provides Slack webhook notification helpers shared across packages. Centralising the config and send helpers here breaks the import cycle that would otherwise arise when integration definitions (e.g. githubapp) need to send Slack messages using infrastructure that lives in ent/hooks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadTemplate

func LoadTemplate(ctx context.Context, fileOverride, embeddedTemplate string) (*template.Template, error)

LoadTemplate resolves either an override template from disk or a bundled template

func NotificationsEnabled

func NotificationsEnabled() bool

NotificationsEnabled reports whether a Slack webhook is configured

func RenderGitHubAppInstallMessage

func RenderGitHubAppInstallMessage(githubOrg, githubAccountType, openlaneOrgName, openlaneOrgID string) (string, error)

RenderGitHubAppInstallMessage renders the GitHub App installation Slack message

func SendNotification

func SendNotification(ctx context.Context, message string) error

SendNotification posts a plain Slack message when webhook notifications are configured

func SendNotificationWithEmail

func SendNotificationWithEmail(ctx context.Context, email, overrideFile, embeddedTemplate string) error

SendNotificationWithEmail renders and posts a Slack message using explicit email and context values

func SetConfig

func SetConfig(c SlackConfig)

SetConfig replaces the active Slack notification configuration

func SubscriberTemplateOverride

func SubscriberTemplateOverride() string

SubscriberTemplateOverride returns the subscriber template override path if configured

func UserTemplateOverride

func UserTemplateOverride() string

UserTemplateOverride returns the user template override path if configured

Types

type SlackConfig

type SlackConfig struct {
	// WebhookURL is the endpoint to send messages to
	WebhookURL string
	// NewSubscriberMessageFile is an optional path to a bespoke Slack template for new subscriber notifications
	NewSubscriberMessageFile string
	// NewUserMessageFile is an optional path to a bespoke Slack template for new user notifications
	NewUserMessageFile string
}

SlackConfig defines the runtime configuration for Slack notifications

func GetConfig

func GetConfig() SlackConfig

GetConfig returns the active Slack notification configuration

Jump to

Keyboard shortcuts

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