webhook

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package webhook implements notify.Notifier with an HTTP POST of a JSON body.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notifier

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

Notifier sends notifications as HTTP POST requests with a JSON body of the form:

{"title":"…","body":"…","level":"info|warn|error"}

func New

func New(webhookURL string, opts ...Option) *Notifier

New creates a webhook Notifier for the given URL.

func (*Notifier) Notify

func (n *Notifier) Notify(ctx context.Context, msg notify.Message) error

Notify sends msg as a JSON POST request to the configured URL.

type Option

type Option func(*Notifier)

Option configures a Notifier.

func WithBearerToken

func WithBearerToken(token string) Option

WithBearerToken sets the Authorization: Bearer <token> header.

func WithHeader

func WithHeader(key, value string) Option

WithHeader adds a static HTTP header to every request.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout overrides the default HTTP client timeout (10 seconds).

Jump to

Keyboard shortcuts

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