Skip to main content

Wait

The Wait task is used when the workflow needs to be paused before continuing. It is a no-op task used when the workflow needs to wait:

  • Until a certain timestamp;
  • For a certain duration; or
  • For an external trigger.

The Wait task will remain in-progress until a certain point. There are three wait types for the Wait task:

  • Until—Used to wait until a specified date and time, including the timezone.
  • Duration—Used to wait until a specified duration in the format: x hours x days x minutes x seconds.
  • Signal—Used to wait for an external signal.

External signals can come from an event handler, direct API call, or a webhook. For example, the task update API can be invoked explicitly to mark the Wait task as COMPLETED.

Task parameters

Configure these parameters for the Wait task.

ParameterDescriptionRequired/ Optional
inputParametersThe input parameters for the Wait task, which can be passed as a variable or a fixed value. These parameters include those required for the Wait task to complete, which depend on the wait type:
  • until for the until wait type
  • duration for the duration wait type
Required.
inputParameters. untilThe datetime and timezone in one of the following formats:
  • yyyy-MM-dd HH:mm z
  • yyyy-MM-dd HH:mm
  • yyyy-MM-dd
For example, 2024-04-30 15:20 GMT+04:00.
Required for until wait type.
inputParameters. durationThe wait duration in the format x days y hours z minutes aa seconds. The accepted units in this field are:
  • days, or d for days
  • hours, hrs, or h for hours
  • minutes, mins, or m for minutes
  • seconds, secs, or s for seconds
Required for duration wait type.

Task configuration

This is the task configuration for a Switch task.

{
"name": "wait",
"taskReferenceName": "wait_ref",
"type": "WAIT",
"inputParameters": {
"until": "2024-04-30 15:20 GMT+04:00"
}
}

Adding a Wait task in UI

To add a Wait task:

  1. In your workflow, select the (+) icon and add a Wait task.
  2. Select the Wait type and configure it.

Adding wait task

Examples

Here are some examples for using the Wait task.

Until wait type

The following task is configured to wait until Dec 25, 2026, 9AM.

// Wait task definition

{
"name": "wait",
"taskReferenceName": "wait_ref",
"type": "WAIT",
"inputParameters": {
"until": "2026-12-25 09:00 GMT+04:00"
}
}

To pass the Wait task parameter as a variable, you can define a workflow input parameter and use it in the Wait task.

// workflow definition

"inputParameters": [
"waitUntil"
],

The Wait task can reference the workflow input parameter using ${workflow.input.variableName}, replacing variableName with the actual variable name.

// Wait task definition

{
"name": "wait",
"taskReferenceName": "wait_ref",
"type": "WAIT",
"inputParameters": {
"until": "${workflow.input.waitUntil}"
}
}

Now, the wait timestamp can be defined at runtime. When running the workflow, you can pass the a specific value as the input:

// workflow inputs

{
"waitUntil": "2024-04-23 15:46 GMT+04:00"
}

Based on the input, the workflow waits until 03:46 PM on 23 April 2024.

Duration wait type

The following task is configured to wait for 28 days.

// Wait task definition

{
"name": "wait",
"taskReferenceName": "wait_ref",
"type": "WAIT",
"inputParameters": {
"duration": "28 days"
}
}

Wait for 28 days

To pass the Wait task parameter as a variable, you can define a workflow input parameter and use it in the Wait task.

// workflow definition

"inputParameters": [
"waitDuration"
],

The Wait task can reference the workflow input parameter using ${workflow.input.variableName}, replacing variableName with the actual variable name.

// Wait task definition

{
"name": "wait",
"taskReferenceName": "wait_ref",
"type": "WAIT",
"inputParameters": {
"until": "${workflow.input.waitDuration}"
}
}

Now, the wait duration can be defined at runtime. When running the workflow, you can pass the a specific value as the input:

// workflow inputs

{
"waitDuration": "1 mins 02 seconds"
}

Based on the input, the workflow waits for 1 minute 2 seconds.

Signal wait type

You can configure the wait type to be signal, which can come from an event handler, direct API call, or webhook.

Here’s a snippet of a Wait task awaiting an external signal from an API call:

{
"name": "wait",
"taskReferenceName": "wait_ref",
"type": "WAIT",
"inputParameters": {}
}

Once the workflow is run, the Wait task will be in an “In Progress” state. Once the external signal is ready, you can manually mark the task as completed either using API or from UI, as shown below:

Wait type configured as signal