webhook

package
v1.31.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 7 Imported by: 0 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 provides a standalone HTTP POST client for sending notifications to a configured webhook URL. It handles Slack auto-detection and formatting so that callers (CLI, IPC, MCP) share a single code path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatSlackText

func FormatSlackText(p Payload) string

FormatSlackText produces a human-readable Slack mrkdwn message from a payload.

func IsSlackWebhook

func IsSlackWebhook(url string) bool

IsSlackWebhook returns true if the URL is a Slack incoming webhook.

func PostNotification

func PostNotification(url, kind, agent, message, project string) error

PostNotification sends a single notification to the webhook URL. It auto-detects Slack webhooks and formats accordingly. Returns an error if the POST fails or the server returns a non-2xx status.

Types

type AnnouncePayload added in v1.11.0

type AnnouncePayload struct {
	Detail    string `json:"detail"`
	Kind      string `json:"kind,omitempty"`
	Agent     string `json:"agent,omitempty"`
	Project   string `json:"project,omitempty"`
	BeadID    string `json:"bead_id,omitempty"`
	Timestamp string `json:"timestamp,omitempty"`
}

AnnouncePayload is the JSON body POSTed to an Agent Radio announce endpoint. Fields use omitempty so only provided values are sent.

type AnnounceResult added in v1.11.0

type AnnounceResult struct {
	// Status is the server-reported status: "queued", "immediate", "suppressed",
	// or "rate_limited" (429), or "error" for failures.
	Status string
	// Message is the human-readable CLI output line.
	Message string
	// Err is non-nil for hard failures (4xx/5xx, timeout, connection refused).
	Err error
}

AnnounceResult describes the outcome of a PostAnnouncement call.

func PostAnnouncement added in v1.11.0

func PostAnnouncement(url string, p AnnouncePayload) AnnounceResult

PostAnnouncement sends a TTS announcement to an Agent Radio endpoint. Unlike PostNotification, it parses the server's JSON response to determine announcement disposition, and treats 429 as a soft success (the server queues rate-limited announcements automatically).

type Payload

type Payload struct {
	Kind      string `json:"kind"`
	Agent     string `json:"agent"`
	BeadID    string `json:"bead_id,omitempty"`
	Detail    string `json:"detail"`
	Timestamp string `json:"timestamp"`
	Project   string `json:"project"`
}

Payload is the JSON body POSTed to the webhook URL.

Jump to

Keyboard shortcuts

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