Wardrik. Hook
(wardrik_protocol v0.1.0-rc.1)
Copy Markdown
Delivers a service's request to an agent's webhook trigger.
:ok = Wardrik.Hook.deliver(scope, "acme/triage", "issues", body: body, headers: headers)
Summary
Functions
Deliver a webhook request to a trigger
Deliver a webhook request, with the secret in its path
Functions
@spec deliver(Wardrik.Scope.t(), String.t() | struct(), String.t() | struct(), term()) :: term() | :ok | {:error, Wardrik.Error.t()}
Deliver a webhook request to a trigger
Asks the agent about a request a service sent its webhook trigger, once the request proves itself with the trigger's secret, and only once. One that doesn't answers not_found, as a trigger there isn't does. unavailable means the agent can't be asked now; the service should send it again later.
POST /v1/hooks/{agent}/{trigger}
@spec deliver_with_secret( Wardrik.Scope.t(), String.t() | struct(), String.t() | struct(), String.t() | struct(), term() ) :: term() | :ok | {:error, Wardrik.Error.t()}
Deliver a webhook request, with the secret in its path
As hook.deliver, for a service that only takes a URL: the secret ends the path. Keep that URL as private as a token.
POST /v1/hooks/{agent}/{trigger}/{secret}