A small Go library for templated webhook and email notifications. Your application owns its events and configuration; Notifykit handles delivery.
- Synchronous delivery or a bounded queue with multiple workers.
- Receiver routing and per-receiver template data.
- Opt-in retries with backoff, jitter, and
Retry-Aftersupport. - HTTP webhooks and SMTP with explicit TLS modes.
- Text and HTML templates, structured errors, and graceful shutdown.
Requires Go 1.27 or newer:
go get github.com/containeroo/notifykitReplace the example URL with your webhook endpoint:
package main
import (
"context"
"log"
"github.com/containeroo/notifykit/notify"
"github.com/containeroo/notifykit/targets/webhook"
"github.com/containeroo/notifykit/templates"
)
type Alert struct{ Message string }
func (a Alert) ID() string { return "alert-1" }
func (a Alert) Data(_ string, _ map[string]any, title string) any {
return map[string]any{"Message": a.Message, "Title": title}
}
func main() {
title, err := templates.ParseStringTemplate("title", "Service alert")
if err != nil {
log.Fatal(err)
}
body, err := templates.ParseTemplate(
"body", `{"text": {{ printf "%s: %s" .Title .Message | json }}}`,
templates.WithDefaultFuncs(),
)
if err != nil {
log.Fatal(err)
}
target := webhook.New(
webhook.WithURL("https://example.com/webhook"),
webhook.WithTitleTemplate(title),
webhook.WithTemplate(body),
webhook.WithValidateJSON(),
)
if err := notify.SendTo(context.Background(), Alert{"API is down"},
notify.NewReceiver("ops", target)); err != nil {
log.Fatal(err)
}
}Start with the documentation overview or getting started. Full guides cover routing, retries, queueing, templates, SMTP, and logging/redaction.
Runnable examples: single receiver and multiple receivers.
Documentation is built with Lore; see the development guide for build instructions.