# $workflowResponse

The `$workflowResponse` function returns information about the **last workflow run with `$callWorkflow`**.

## Syntax

```text
$workflowResponse[(property)]
```

## Parameters

| Parameter | Description |
|---|---|
| `property` | Optional - Name of a result of the last workflow (trimmed). Without it (or when empty), the status of the last call is returned. |

`$workflowResponse` takes 0 or 1 argument.

## Return Value

- **Type**: String
- Without argument: `WORKFLOW_OK:` followed by the entry point of the workflow that was called (for example `WORKFLOW_OK:main`).
- With `property`: the named result of the last workflow (for a BibiScript script workflow, `output` is the text it produced and `script` is `BDFD_OK`); an empty string if there is none.
- An empty string if no workflow has been called yet.

## Behavior

- The values are set by each successful `$callWorkflow[name;...]` call; the results of the previous call are removed first.
- A workflow that stops the script also stops the calling script.

## Examples

### Call and retrieve the status

```bdfd
$callWorkflow[dailyReward;user=$authorID]
Workflow status: $workflowResponse
```

### Read the output of a script workflow

```bdfd
$callWorkflow[calculSalaire;user=$authorID]
Your calculated salary: $workflowResponse[output]
```

### Chain of workflows

```bdfd
$callWorkflow[verifyUser;user=$authorID]
$if[$workflowResponse[output]==ok]
  $callWorkflow[processOrder;user=$authorID]
  Order processed: $workflowResponse
$else
  Verification failed.
$endif
```

## Notes

- `$workflowResponse` is overwritten with each new call to `$callWorkflow`.
- Store the value in a temporary variable if you need to reuse it: `$var[rep;$workflowResponse[output]]`.
- Arguments are passed to `$callWorkflow` as `name=value` (or positionally).
- These examples assume the workflows named in them exist in the bot.
