AwaitWebInput States
An AwaitWebInput state blocks the flow run until a respondent submits a response to the referenced web input.
Once a response is received, the response value is placed into the run’s state and execution continues.
If no response is submitted within 10 days, the state times out and the run ends with an error.
For an overview of the web input feature, see Web Inputs.
Fields
-
Type(required) -
Must be
"AwaitWebInput". -
Parameters(required) -
An object identifying the web input to wait for.
-
Parameters.WebInputId(required) -
The ID of the web input to await. This will almost always be a JSONPath reference to the output of a preceding
CreateWebInputstate. For example:"WebInputId.$": "$.create.web_input_id". -
InputPath(optional) -
A JSONPath expression that selects a portion of the run’s state to pass as input to the state’s parameters. If omitted, the entire run state is passed as input.
-
ResultPath(optional) -
A JSONPath expression indicating where the response data will be placed in the run’s state. The result object includes a
responsefield containing theValueof the option the respondent selected. If omitted, the default is$. -
Catch(optional) -
An array of error handling objects that specify how to handle errors that occur in this state. See Error Handling.
-
NextorEnd(one required) -
Nextspecifies the name of the following state.End: trueindicates that the run terminates after this state completes.
Timeout
An AwaitWebInput state times out after 10 days with no response.
When a timeout occurs, the state exits with an error of type
Flows.WebInputExpired.
Add a Catch clause to handle the timeout and transition to a recovery state
instead.
{
"WaitForApproval": {
"Type": "AwaitWebInput",
"Parameters": {
"WebInputId.$": "$.create_result.web_input_id"
},
"ResultPath": "$.await_result",
"Catch": [
{
"ErrorEquals": [
"Flows.WebInputExpired"
],
"ResultPath": "$.timeout_error",
"Next": "HandleTimeout"
}
],
"Next": "CheckResponse"
}
}
Examples
This example awaits a web input created in a prior state, then uses a Choice state to branch based on the respondent’s selection.
{
"WaitForApproval": {
"Type": "AwaitWebInput",
"Parameters": {
"WebInputId.$": "$.create_result.web_input_id"
},
"ResultPath": "$.await_result",
"Next": "CheckResponse"
},
"CheckResponse": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.await_result.response",
"StringEquals": "approve",
"Next": "ProceedWithOperation"
},
{
"Variable": "$.await_result.response",
"StringEquals": "deny",
"Next": "CancelOperation"
}
]
}
}