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 ¶
FormatSlackText produces a human-readable Slack mrkdwn message from a payload.
func IsSlackWebhook ¶
IsSlackWebhook returns true if the URL is a Slack incoming webhook.
func PostNotification ¶
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).