Documentation
¶
Overview ¶
Package webhook is the incoming webhook connector (docs/connectors.md, «Incoming webhook»): a personal address on the hub that a service (GitHub, GitLab, Grafana, Alertmanager, Sentry, n8n, Zapier, Make, anything that posts JSON) sends its events to. The hub keeps nothing of a request: it passes it over the machine's link to the runtime (connectors.webhook), and here, on the machine, the signature is checked by the connection's secret from the safe, the body is kept under the connection's folder for the agent's reads, and the event becomes a webhook.received envelope without text, with its kind (alert.firing, ci.failed, pr.opened, issue.assigned…) as a fact.
Index ¶
Constants ¶
const ( PresetGitHub = hookauth.PresetGitHub PresetGitLab = hookauth.PresetGitLab PresetGrafana = hookauth.PresetGrafana PresetAlertmanager = hookauth.PresetAlertmanager PresetSentry = hookauth.PresetSentry PresetJSON = hookauth.PresetJSON )
Presets of the services it understands.
const ( AuthHeader = hookauth.AuthHeader AuthPath = hookauth.AuthPath )
How a service proves a request is its own, for the presets that let the person choose.
const EventReceived = "webhook.received"
EventReceived is its one event type; the kind of what happened is the fact "kind".
const ID = "webhook"
ID names the connector.
const (
// MaxBody is the largest body taken; the hub refuses a larger one before it reaches the machine.
MaxBody = 1 << 20
)
const SourceKey = "hookSource"
SourceKey is the config key the managed path sets to the hub's source of the webhook (stage 4): its address is then the hub's /hook/t/<source>/<token>, and the hub checks the signature.
Variables ¶
var Base = func() string { return "" }
Base is the public address of this machine's webhooks on its hub (https://hub.example.com/api/platform/automations/ hook/m/<machine>), set by the runtime; "" while the machine is not linked to a hub.
Functions ¶
func HubBase ¶
func HubBase() string
HubBase is the hub's address of webhooks (…/automations/hook), from Base.
func ManagedAddress ¶
ManagedAddress is the address of a webhook the hub keeps: /hook/t/<source>/<token>, the token derived from the secret the service signs with (hookauth.RouteToken). "" while the machine is not linked to a hub.
Types ¶
This section is empty.