Actions

Each webhook that is fired contains an action field which describes what the webhook is for. Depending on your integration, you may not need to subscribe to all actions, but only specific ones.

The most common action that you will be required to subscribe to will be job_batch.status.transition which will allow you to determine when a Job Batch has reach "dispatched" status.

Job status transition

This action is fired when a Job status has been updated. You can extract the Job status as follows:

const status = payload.job.status.canonical;

# "job.status.production_dispatched"

To see a list of Job statuses, see Statuses.

Example webhook:

{
  "id": "138e434c-2d67-4ba5-aa3e-1cecc01b9db4",
  "environment": {
    ..
  },
  "action": "job.status.transition",
  "payload": {
    "job": {
      "status": {
        "id": "55655879-8433-4c43-8e1a-fea3e710212f",
        "canonical": "job.status.production_dispatched",
        "reason": "Palm: fulfilment dispatched",
        "value": "production_dispatched",
        "translation": {
          "locale": "en",
          "name": "Production Dispatched",
          "summary": "The job has been dispatched."
        },
        "user": {
          "id": "5933e6bb-9f93-36b9-a428-4b89010a2e82",
          "job_title": "Automated Workflow",
          "name": "System",
          "email": "system@printed.com",
        },
        "created_at": {
          "iso": "2024-02-29T10:27:16+00:00"
        }
      },
      ..
    }
  },
  "created_at": {
    "iso": "2024-02-29T10:23:37+00:00"
  }
}

Job Batch status transition

This action is fired when a Job Batch status is updated. You can extract the Job Batch status as follows:

const status = payload.batch.status.canonical;

# "job_batch.status.dispatched"

To see a list of Job Batch statuses, see Statuses.

Example webhook:

{
  "id": "71e34f66-8189-4e8b-9185-f9e3b7a72998",
  "action": "job_batch.status.transition",
  "environment": {
    ..
  },
  "created_at": {
    "iso": "2024-02-29T10:40:15+00:00"
  },
  "payload": {
    "batch": {
      "id": "2088958f-34ea-4eda-be96-33ffc0e77c4c",
      "status": {
        "canonical": "job_batch.status.dispatched",
        "translation": {
          "locale": "en",
          "name": "Dispatched",
          "summary": "This job batch is dispatched."
        }
      }
      ..
    }
  }
}