Skip to main content

Wait

The wait task is used when the workflow needs to be paused for an external signal to continue. It is used when the workflow needs to wait and pause for external signals, such as a human intervention (like manual approval).

Definitions

   {
"name": "wait",
"taskReferenceName": "wait_ref",
"type": "WAIT",
"inputParameters": {
"until": "2024-04-30 15:20 GMT+04:00",
"key": "${workflow.input.value}"
}
}

Input Parameters

ParameterDescription
Wait typeIndicates the type of wait period. Supported types include until, duration, and signal.
  • Until - Used to wait until a specified date & time, including the timezone. The date/time can be supplied in the format: YYYY-MM-DD hh:mm a/pm. For example, 2024-04-30 15:20 GMT+04:00.
  • Duration - Specifies the wait duration in the format x days x hours x minutes x seconds. The accepted units in this field are days, d, hrs, hours, h, minutes, mins, m, seconds, secs, and s.
  • Note: You can use the duration format to configure the wait period according to your requirements. For example, if you need to wait for 10 mins, you can use this format in your JSON "inputParameters": {"duration": "10 minutes" }. Or, you can provide 10 in the minute's field from the UI as shown below:

    Wait for 10 mins example

  • Signal - Configure this option if the workflow needs to wait for an external signal, such as a manual approval.
inputParametersConfigure the input parameters required for the task. It can also be passed as a variable. See the section below for a complete example.

Examples



  1. Add task type Wait.
  2. Select the wait type and provide its configuration.

Adding wait task

Sample Workflows

Case 1 - Using 'Wait type' as 'Until'

The following task waits until Dec 25, 2026, 9 AM GST. Yes, that's right, 2026!

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

Now, if you want to pass the wait parameter as a variable, let’s consider that you are passing the variable parameter as a workflow input.

Let’s define the workflow input parameter as “waitUntil”.

 "inputParameters": [
"waitUntil"
],

Now, let’s configure the wait type referring to this variable as below:

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

Let’s run the workflow using the following input:

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

The workflow waits until 03:46 PM GST (GMT+04:00) on 23rd Apr 2024.

Depending on the use case, the variables can be updated, and the workflow takes the wait parameter from these variables.

Case 2 - Using 'Wait type' as 'Duration'

Suppose you have a subscription workflow running that needs the wait period to be 28 days.

Here’s the snippet of the workflow JSON where the wait task is configured to wait for 28 days:

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

Or you can also provide 28 under the Days field from the UI, omitting the rest of the fields like this;

Wait for 28 days

Now, if you want to pass this parameter on as a variable, and the variable is passed as a workflow input called waitDuration.

In this case, the workflow JSON is as shown below:

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

Now, let’s run the workflow using the following input:

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

So, here, the workflow waits for 1 minute & 2 seconds at the configured wait task.

The accepted units in this field are:

  • Days - days, d
  • Hours - hours, hrs, h
  • Minutes - minutes, mins, m
  • Seconds - seconds, secs, s
Case 3 - Using 'Wait type' as 'Signal'

Suppose you want the workflow to wait for an external signal to continue.

In that case, you can configure the wait type to be signal, and here’s a snippet of the workflow waiting for an external signal:

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

Once the workflow is run, it will be in a running state, and 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