webhook

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChatText added in v0.0.24

func ChatText(e types.InteractionEvent) string

ChatText renders the standard chat-notifier body: the event details, its raw data in a code block, and — when available — a curl command to replay the request in a second code block. Sink-hit events get an enriched header. Binary data is replaced with a placeholder to avoid garbled chat messages.

func CurlCommand added in v0.0.24

func CurlCommand(e types.InteractionEvent) string

CurlCommand returns a replay curl command for events that can produce one (HTTP), or "" otherwise.

func FilterMatches

func FilterMatches(filter *regexp.Regexp, data string) bool

func NewNotifierFromConfig added in v0.1.3

func NewNotifierFromConfig(cfg map[string]string) types.Notifier

NewNotifierFromConfig creates a standalone webhook notifier from a YAML config map. Recognized keys: "url" (required), "filter" (optional, defaults to ".*").

func SendPost

func SendPost(url string, payload []byte) error

func ShouldSend added in v0.1.6

func ShouldSend(filter *regexp.Regexp, e types.InteractionEvent) bool

ShouldSend reports whether a notifier should deliver the event. It returns true when the event bypasses filters (e.g. sink-hit events) or when the filter regex matches the event's FilterString.

func TruncateChat added in v0.1.6

func TruncateChat(s string, max int) string

TruncateChat truncates a chat message to max characters, closing any open markdown code block so the rendering isn't broken.

Types

type Notifier

type Notifier struct {
	URL string
	// contains filtered or unexported fields
}

func NewNotifier added in v0.0.2

func NewNotifier(url string, filter string) *Notifier

func (*Notifier) Filter

func (wh *Notifier) Filter() *regexp.Regexp

func (*Notifier) Name

func (wh *Notifier) Name() string

func (*Notifier) Payload

func (wh *Notifier) Payload(e types.InteractionEvent) ([]byte, error)

func (*Notifier) Send

func (wh *Notifier) Send(event types.InteractionEvent) error

Jump to

Keyboard shortcuts

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