Engine API

Hooks and events

Get called when something happens on a job.

Markdown

Events

Everything that happens to a job is recorded as an event: created, assigned, started, a node reached, an action completed, canceled. Read them with GET /engine/jobs/{jobId}/events, oldest first. Event ids are time-ordered.

Hooks

A hook calls your URL when an event matches its filters. Add it when you create the job (hooks) or later with POST /engine/jobs/{jobId}/hooks:

JSON
{
  "name": "notify-arrival",
  "eventType": ["node_arrived"],
  "nodeName": ["dropoff"],
  "target": "https://example.com/hooks/remi",
  "metadata": { "webhook": { "method": "POST", "headers": { "X-Key": "your-secret" } } }
}
  • Filters: eventType, nodeName, actionName, actionType, packageName and jobState. A filter you leave out matches everything.
  • An https:// target is a webhook. Put your secret in metadata.webhook.headers: calls are not signed.
  • The body is { timestamp, event, hook, jobId }, with the Event that fired it.

Order

Hooks of one job that share a queueName run one at a time, in event order, and a failing call is retried before the next one runs. Without a queueName, hooks run concurrently.

The Delivery API's webhooks are hooks like these, on one queue per delivery.