You can subscribe to run notifications across all your Jobs using the on() instance method, which currently supports two events:

  • runSucceeded: Triggered when a run succeeds.
  • runFailed: Triggered when a run fails.

Both events receive a Run Notification object as their only parameter.

You can use the notification to determine which job the run belongs to, access the run’s payload, output, errors, and more.

If you want to subscribe to just a single Job, see the defineJob docs.

Parameters

event
runSucceeded | runFailed
required

The notification event to listen for.

callback
function
required

The callback function to run when the event is triggered. Receives a Run Notification object as it’s only parameter.