> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kapso.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Wait for response

> Wait for user input before continuing

Pauses workflow execution until the user sends a message. Optionally configure a timeout to automatically continue if no response is received.

## Configuration

* `id`: Unique node identifier
* `save_response_to`: Variable name to store user response (optional)
* `has_timeout`: Enable automatic timeout (optional)
* `timeout_seconds`: Timeout duration in seconds, between 10 and 604800 (7 days)

## Workflow library example

```javascript theme={null}
workflow.addNode("wait_for_reply", {
  type: "wait_for_response",
  saveResponseTo: "latest_reply",
  timeoutSeconds: 300
});
```

## Storing responses

User responses are automatically saved to `{{last_user_input}}`.

Use `save_response_to` to store the response in a custom variable. Response content is saved as text.

## Timeout behavior

When timeout is enabled:

* Workflow automatically continues after the specified duration if no user response is received
* `{{system.last_resume.reason}}` is set to `"timeout"` (vs `"user_input"` for normal responses)
* No value is written to `{{last_user_input}}` or custom response variables on timeout
* Use a Decide node after the wait to branch based on `{{system.last_resume.reason}}`

### Detecting timeouts

Check why the workflow resumed:

```
{{system.last_resume.reason}}  # "user_input" or "timeout"
```

If a user responds before the timeout, the timeout is automatically cancelled.

## Usage patterns

**Question → Wait → Route**

```mermaid theme={null}
graph LR
    A[Send message] --> B[Wait for response] --> C[Decide]
```

**Menu → Wait → Process**

```mermaid theme={null}
graph LR
    A[Send interactive] --> B[Wait for response] --> C[Function]
```

**Custom variable**

```mermaid theme={null}
graph LR
    A[Send text<br/>Ask for name] --> B[Wait<br/>save_response_to: user_name] --> C[Function<br/>Process {{user_name}}]
```
