Workflow Definitions

Workflows definitions allow you to configure a pre-defined process for entries. Each workflow definition describes the schema for its workflows by a sequence of workflow steps which the executed workflows undergo.

Limitations

A workflow definition can define up to 20 steps. Defining more than 20 steps will result in a validation error.

The current maximum limit for workflow definitions is 20. If you lose access to the workflow API due to a price and package downgrade we will ensure that you can delete and complete existing workflows. An overview for our pricing and packaging can be found here.

Workflow definition schema

Besides the sequence of workflow steps, there are multiple properties to specify how workflows behave.

FieldTypeRequiredDescription
nameStringtrueName of the workflow definition
descriptionStringfalseExplaining notes, e.g. a description of the use case
appliesToArray[Object] *falseTarget entries for which workflows of this definition can be used.
flowTypeStringfalseCan be no_restriction (default) or strict_neighbor. See the following paragraphs for more guidance.
startOnEntityCreationBooleanfalseAutomatically start a workflow on targeted entries when they are created (default: false). See the following paragraphs for more guidance.
stepsArray[Object]falseOrdered list of steps which a workflow undergoes. The shape of a step is described in a following chapter.
sysSys **trueSystem resource properties

* The items in the list appliesTo must match the following shape:

{ linkType: "Entry", type: "Link", validations: [{ linkContentType: ["contentTypeA", "contentTypeB"] }] }

It is recommended to have only one item in appliesTo as well as only one item in validations. If you want to address multiple content types, you can do so by mentioning multiple within the list at linkContentType.

** In addition to the common sys properties, a workflow definition has the following extra sys properties

FieldTypeDescription
isLockedBooleanIf the set up of permission rules was incomplete, the definition is marked as locked until it is saved again.
lockReasonstringProvides context about why the last save request wasn’t successful.
The flow type of a workflow definition

The property flowType controls to which step a user can move a workflow. It supports the follow two modes:

  • no_restriction: Apply no restrictions when moving a workflow to another step.
  • strict_neighbor: Enforce non-admin users to only move to the previous or the following step. The workflow can only be marked as ‘complete’ upon reaching the last step.

Automatically start workflows

The property startOnEntityCreation will automatically start a workflow for newly created targeted entries. Each time you create an entry of a content type configured for this workflow definition, the workflow will start automatically. However, this does not mean that workflows are started for entries that were already created before setting this property to true.

Assign multiple workflows to the same content type(s)

You can choose to configure multiple workflows for the same content type. This allows different teams working on the same content type to use dedicated workflows for their own review processes and governance.

Workflow step schema

A step within a workflow definition is described by the following properties.

FieldTypeRequiredDescription
idStringtrue *Internally defined ID
nameStringtrueName of the workflow step
descriptionStringfalseExplaining note
annotationsArray[String]falseList of meta tags. To render a color in the Contentful UI, add a string with the shape cf-color-1 (allowed digits: 1-6).
permissionsArray[Object]falseAllow or deny actions for selected users when a workflow is in this step.
actionsArray[Object]falseAutomated actions that are triggered when a workflow reaches this step.

* When leaving out the id in a POST/ PUT request for a workflow definition, you create a new step at that position in the list. When you define it (in a PUT request), you thereby update the existing step with that id.

Workflow step permission schema

In addition to the permission defined by a users role, a workflow step can restrict or grant permissions for selected users or teams. The permissions can only apply to a single active step in a workflow. The user restrictions in step permissions do not apply to organization or space admins. One permission must provide the following properties:

FieldTypeRequiredDescription
typeStringtrueCan be entity_permission or workflow_permission. *
configuration.effectStringtrueCan be allow or deny.
configuration.actionStringtrueCan be edit or publish. Publishing is only available for entity permissions (see type).
configuration.actorsString | Array[Link]trueCan be all or a list of user/ team links. Defines who is targeted by this permission rule.

* There are two supported types for targeted resources:

  • workflow_permission: Use this together with the action being edit to explicitly allow or deny who can move the workflow to another step.
  • entity_permission: Grant or restrict permission to edit or publish the entry on which the workflow is being executed.

Workflow step action schema

When a workflow reaches a step, it will automatically trigger the actions defined for this step. Those actions can be one of the following three:

  • Send an email to a set of users and teams. Additionally, you can also use any valid email address. The email notifies about the workflow being moved to this step. So far, the template is fixed and cannot be changed. There may be only one email action per step.
  • Create an entry task with a customisable message and assign it one user or team. Optionally, you can define a due date. Please note that you need to have the tasks app installed. You can define up to three task actions per step.
  • Send a custom message via Slack to a selected (public) channel about the workflow being moved to another step. Please note that you need to have the Slack app installed to use its app action. There may be only one Slack action per step.

Depending on the type, an action is defined by the following properties:

FieldTypeRequiredDescription
typeStringtrueCan be email, task or app (for Slack).
configuration.recipientsArray[Link | String]if type is emailRecipients of the sent out email.
configuration.assigneeLinkif type is taskAssignee (user or team) of the created task.
configuration.bodyStringif type is taskText of the created task.
configuration.dueDateNumberfalseDays to add to the current timestamp to calculate the due date.
appIdStringif type is appID of the installed Slack app.
appActionIdStringif type is appID of the installed Slack app action.
configuration.bodyObjectfalseOptional payload for the Slack app action. May be defined when the type equals app.

Workflow definitions collection

Get all workflow definitions

This endpoint returns a paginated list of workflow definitions for a given environment.

Permissions

Any user can read workflow definitions.

Create a workflow definition

Use this endpoint to create a workflow definition.

Permissions

Only organization or space admins can create a workflow definition.

Workflow definition

Get a workflow definition

Permissions

Any user can read a workflow definition.

Update a workflow definition

Permissions

Only organization or space admins can update a workflow definition.

Delete a workflow definition

Permissions

Only organization or space admins can delete a workflow definition.