Create or Update Workflow

Changed on

Create a new workflow or update the draft version of an existing one

post/v1/{workspace}/workflow/{slug}/

Request

Path parameters

workspacestring required

Workspace where the workflow should be created (staging, production, etc.)

slugstring required

Unique identifier of the workflow. You can get it from workflow settings for existing workflows.

Query parameters

commitboolean

Whether to commit the workflow immediately. Workflow will be successfully committed only if validation_result.is_valid is true.

commit_messagestring

Optional commit message describing the changes. Used only when commit=true.

Request body

namestring required

Human-readable name of the workflow. The workflow slug is taken from the URL path, not generated from this name.

descriptionstring nullable

Description explaining the usecase of the workflow

is_enabledboolean

Whether the workflow should be enabled

categorystring required

Notification category of the workflow. Used to apply category-specific settings and preferences.

tagsstring[]

Tags are used for grouping and filtering workflows in list (max 25).

trigger_type'event' | 'api' required

You can trigger a workflow either via API by passing its slug directly, or through an event-based system where the workflow runs when a specific event occurs. You can compare both methods here. If the workflow should run when a user enters or exits a list, use trigger_type = event.

trigger_eventsstring[]

Events that trigger this workflow (required if trigger_type = event, max 10). In case of list entry/exit, event names will be $USER_ENTERED_LIST - <list_id> and $USER_EXITED_LIST - <list_id> respectively.

override_recipients_type'user' | 'single_object_fields'

Override recipients using a property from the trigger payload. Type defines if the workflow should run for a list of users or a single object. Only applicable for trigger_type = event.

override_recipients_user_exprstring nullable

JQ expression to override recipients when override_recipients_type = user. Only applicable for trigger_type = event.

override_actor_user_exprstring nullable

JQ expression to override actor. Only applicable for trigger_type = event.

override_tenant_exprstring nullable

JQ expression to override tenant. Only applicable for trigger_type = event.

Example request

{
  "name": "Welcome Sequence",
  "category": "transactional",
  "tags": [
    "onboarding-sequence"
  ],
  "payload_schema": {
    "schema": "onboarding-sequence-schema",
    "version_no": 1
  },
  "ratelimit": {
    "count": 4,
    "sliding_window": "6m"
  },
  "conditions": [
    {
      "type": "expression_v1",
      "expression_v1": {
        "args": [
          {
            "op": "==",
            "value": "\"admin\"",
            "variable": "role",
            "variable_ns": "$recipient"
          }
        ]
      }
    }
  ],
  "override_recipients_type": "user",
  "override_recipients_user_expr": ".distinct_id",
  "override_recipients_single_object_fields_expr": {
    "id": ".object_id",
    "object_type": ".object_type",
    "$object_subscriptions_query.depth": "2"
  },
  "override_actor_user_expr": ".actor_id",
  "override_tenant_expr": ".tenant_id",
  "tree": {
    "nodes": [
      {
        "name": "Wait 30 minutes",
        "properties": {
          "relative_to": {
            "pivot_expr": ".start_time"
          }
        }
      }
    ]
  }
}

Response

Workflow created. The response includes the saved workflow object along with a validation_result field that indicates whether the workflow configuration is valid. When commit=true is passed, a commit_result field is also returned.

Changes

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property /////

    • breaking

      added the new required request property /////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      added the new required request property ////

    • breaking

      the request property //////// became required

    • breaking

      removed the enum value $workflow of the request property ///////////

    • breaking

      removed the enum value OR of the request property /////////

    • breaking

      the //// request property type changed from string to object

    • breaking

      response property detail list-of-types was widened by adding types array and object to media type application/json of response 401

    • breaking

      response property detail list-of-types was widened by adding types array and object to media type application/json of response 404

    • warning

      the request property's maxLength was set to 500

    • warning

      the request property's maxLength was set to 255

    • warning

      the / request property's maxLength was set to 16

    • warning

      the / request property's maxLength was set to 128

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the //// request property's maxLength was set to 64

    • warning

      the / request property's maxLength was set to 255

    • warning

      the / request property's max was set to 100.00

    • warning

      the / request property's min was set to 1.00

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property //////////

    • warning

      removed the request property //////////

    • warning

      removed the request property //////////

    • warning

      removed the request property //////////

    • warning

      removed the request property ///////////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • warning

      removed the request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property //////////

    • info

      added the new optional request property //////////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ///////////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      added the new optional request property ////

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      the request property //// became optional

    • info

      added the new $actor enum value to the request property /////

    • info

      added the new $brand enum value to the request property /////

    • info

      added the new $brand enum value to the request property ///////////

    • info

      added the new $category enum value to the request property /////

    • info

      added the new $category enum value to the request property ///////////

    • info

      added the new $organization enum value to the request property /////

    • info

      added the new $organization enum value to the request property ///////////

    • info

      added the new $ref enum value to the request property ///////////

    • info

      added the new ARRAY_INTERSECTS enum value to the request property ///////////

    • info

      added the new IS enum value to the request property ///////////

    • info

      added the new IS_NOT enum value to the request property ///////////

    • info

      added the new NOT_ARRAY_INTERSECTS enum value to the request property ///////////

    • info

      the //// request property's minLength was decreased from 1 to 0

    • info

      added the non-success response with the status

    • info

      added the optional property to the response with the status

    • info

      added the success response with the status

    • breaking

      removed the enum value $brand of the request property ///////////

    • info

      added the new $tenant enum value to the request property ///////////