Wardrik. Hook
(wardrik_protocol v0.1.0-rc.6)
Copy Markdown
Delivers a service's request to an agent's webhook trigger.
:ok = Wardrik.Hook.deliver(scope,
agent: "agt_1",
trigger: "issues",
body: body,
headers: headers
)
Summary
Functions
Deliver a webhook request to a trigger.
Deliver a webhook request with the secret in the path.
Functions
@spec deliver(Wardrik.Scope.t(), keyword()) :: term() | :ok | {:error, Wardrik.Error.t()}
Deliver a webhook request to a trigger.
Wardrik.Hook.deliver(scope, agent: "agt_1", trigger: "daily", body: body, headers: headers)Runs the agent once for a request sent to its webhook trigger, after checking the request against the trigger's secret. A request that fails the check returns not_found, the same as a missing trigger. unavailable means the agent can't run now and the service should retry later.
POST /v1/hooks/{agent}/{trigger}
@spec deliver_with_secret(Wardrik.Scope.t(), keyword()) :: term() | :ok | {:error, Wardrik.Error.t()}
Deliver a webhook request with the secret in the path.
Wardrik.Hook.deliver_with_secret(scope, agent: "agt_1", trigger: "daily", secret: "s3cret", body: body, headers: headers)Works like hook.deliver, for services that only accept a URL. The secret is the last path segment of the URL. Keep this URL as private as an API token.
POST /v1/hooks/{agent}/{trigger}/{secret}