## Flow Management

The Flow Management functionality allows the integrator to interact with the onboarding flow in real time. Through webhook notifications, the integrator can intervene at specific points in the flow to evaluate the collected data and decide how to proceed — approving the continuation, asking the user to repeat a step, or blocking the flow. Additionally, the end user has the option to return to the identification provider selection page at any time, without having to start over from the beginning.

### Integrator responds with a Verdict

With the **Flow Management** feature, an integrator can interact with the onboarding flow in real time. At specific points in the flow, the system pauses and sends a **webhook notification** to the integrator. The flow does not proceed until the integrator responds with a **Verdict**.

This enables the integrator to:

- Run additional checks on collected data
- Correct input parameters before the user retries a step
- Send a customized message to the end user
- Block or approve continuation of the flow


## Verdict Steps

The Verdict can be enabled or disabled at the **request type** level. When enabled, it is active at the following points in the flow:

| Step name | Step | Trigger point | Retry behavior |
|  --- | --- | --- | --- |
| documentRetrieveVerdict | **Verdict Doc Retrieve** | After document collection | User returns to the identification provider choice page |
| afterIdentificationVerdict | **Verdict Post-ID** | After identification phase (including idSelf Split after biometry) | User returns to the identification provider choice page |
| afterReinforcementIdentificationVerdict | **Verdict Post-Reinforcement** | After reinforcement identification | User returns to the start of the reinforced identification |
| preSignOperatorValidation | **Verdict Pre-Sign** | Before the signature step (Sign flow only) | User returns to the beginning of the flow |


## Webhook Notification

When the flow reaches a Verdict step, the system sends a `STATUS_UPDATE_STEP` webhook to the integrator. The flow **remains paused** until the integrator calls the Verdict endpoint.

**Example webhook payload:**

```json
{
  "id": "aaaaaaaaa-1111-1111-abc1-63a674114a26",
  "type": "STATUS_UPDATE_STEP",
  "createdAt": "2026-04-20T15:39:43.959736+01:00",
  "request": {
    "requestId": "bbbbbbbb-1111-2222-9ccc-d92704a80e44",
    "requestTypeId": "cccccccc-1111-2222-97b3-17a8ead78fb7",
    "status": "RUNNING",
    "actor": "userToIdentify",
    "actorStatus": "ACTIVE",
    "stepName": "afterIdentificationVerdict",
    "stepId": "afterIdentificationVerdict",
    "stepStatus": "ACTIVE",
    "language": "en"
  }
}
```

**Note:** The `language` field in the webhook reflects the current actor's language. Use this to write the `customerMessage` in the correct language.

![Onboarding with Flow flow_management](/assets/flow_management.aaf72ecf511e7c399e8f06642dfc352e20b91c9eeb1aeca48d988d8f224404d4.c6e0f37c.png)

## Implementing the Verdict

Once the integrator receives a `STATUS_UPDATE_STEP` webhook at a Verdict step, the flow
pauses and waits for the integrator to call the Verdict endpoint:

```
POST /request/{requestId}/actor/{actor}/verdict?stepId={stepId}
```

Use the `actor` and `stepId` values from the webhook payload.

### Verdict Values

| Verdict | Description |
|  --- | --- |
| `CONTINUE` | Approves continuation. The flow moves to the next step. |
| `RETRY` | Requests the user to repeat the current step. The redirect behavior depends on the step type (see [Verdict Steps](#verdict-steps)). |
| `NOT_OK` | Blocks the flow and terminates the request. |


### Amendment: Updating Input Before Retry

When posting a `RETRY` verdict, the integrator can include an `amendment` object to
update the request input before the user retries the step:

```json
{
  "verdict": "RETRY",
  "customerMessage": "Please retry the identification process.",
  "amendment": {
    "parameters": {
      "fiscalCode": "RSSMRA85T10A562S"
    }
  }
}
```

The values in `amendment.parameters` are **merged** with the original request input — they
do not replace it entirely. If the Data Enrichment configuration uses the request input for
field pre-population, the user will see the updated values at the next attempt.

**Clearing a field:** passing `null` does not clear a field. To clear a string field,
pass an empty string (`""`).

### Retry Without Amendment

If a `RETRY` verdict is posted without an `amendment` object, the user sees the values
they entered previously — fields are not reset to empty.

### customerMessage

The `customerMessage` field accepts **plain text only**. HTML and Markdown are not rendered.

Use the `language` field from the webhook payload to write the message in the user's
current language.

### Error Handling

If NOB responds with an error to the Verdict call:

| HTTP status | Recommended behavior |
|  --- | --- |
| `4xx` | Do not retry. These indicate a client-side problem (invalid parameters, wrong state, etc.). |
| `5xx` | Retry with exponential backoff. Recommended: max 5 attempts. |


### Timeout

There is no maximum timeout for posting the Verdict. The Verdict step remains active
until the integrator resolves it, or until the request reaches its configured expiry.

### Change of Identification Method

During the flow, the user can return to the provider selection page without having to start over from the beginning.

The behavior varies depending on the type of provider:

- **External provider (redirect):** the frontend automatically redirects to the external site on the first access. If the user goes back (via browser history or email link), the system detects the difference in the `frontendNonce` parameter and displays an intermediate page that allows the user to choose whether to continue or go back to the provider selection.
- **Provider in iframe:** the NOB frontend exposes a dedicated button that allows the user to return to the provider selection page at any time.


![Onboarding change id method](/assets/change_id.6220c8fd1ad950b4c2b278a3edd3e8633b3b15f552184a6031dae0c4eb4ca96d.c6e0f37c.png)