# Custom Module

The Custom Module pauses a Workflow and hands control to your application, which runs custom logic and returns a result that determines how the Workflow continues.

<Callout icon="⚠️" theme="warn">
  ### SDK Required

  The Custom Module requires an SDK integration to function. The steps on this page cover Dashboard configuration only: adding the module to a Workflow, referencing the callback function name from your SDK, and configuring Conditions to branch on the result. The callback that resumes the Workflow is implemented in your SDK code. See [SDK Reference](https://developer.incode.com/docs/sdk-reference) for those instructions.
</Callout>

For an overview of this module and how it works, see [Custom Module](https://developer.incode.com/docs/custom-module).

## Supported with:

:white_check_mark: Workflows | :x: Flows

## Add Custom Module to Workflows

1. In the left menu, click **Flow Builder** > **Workflows**.
2. Click **New** or select an existing Workflow.
3. From the Modules list, drag and drop the **Custom Module** into the builder.
4. Click the three dots > **Edit** on the module node to open the [Configuration Options](#configuration-options) panel and adjust settings as needed.

## Configuration Options

After making changes, click **Save configurations** to apply them.

![](https://files.readme.io/f9f01bad4ad72f923f0a68d3b8ee0da114614980e01dfb60dc41d90095b221cf-image.png)

| Setting                 | Description                                                                                                                                                                                                                                                                                                                                                              |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **_Callback Function_** | The name of the callback function in your SDK integration that Incode invokes when the Workflow reaches this module. The value is a string and must exactly match the function name implemented in your SDK integration. Your callback must return `onSuccess`, `onFail`, or `onUnknown` to advance the Workflow. If no result is returned, the Workflow remains paused. |

## Add Conditions

[Conditions](https://developer.incode.com/docs/configure-workflow-conditions) let you branch the Workflow based on a result. Your SDK callback must return one of three results: `onSuccess`, `onFail`, or `onUnknown`. Your Workflow should define a distinct path for each. A common pattern is to route `onUnknown` to a step-up such as [ID Capture](https://developer.incode.com/docs/id-capture) or manual review, instead of treating it the same as `onFail`.

The steps below walk through one example configuration: two Conditions in sequence, with `onSuccess` routing to Session Pass, `onFail` routing to Session Failed, and `onUnknown` routing to Manual Review. This is one valid approach; you can structure the Conditions, result nodes, and step-up behavior differently to fit your use case.

### 1. Condition for `onSuccess`

The following steps detail the Condition configuration for the `onSuccess` path.

1. Drag a Condition into the builder from the left panel. Place it directly after the Custom Module node.

   ![](https://files.readme.io/a34283c1929e70f5e61dbec7579325b756098d97cc998873db8ec804a996a598-image.png)
2. In the first drop-down, search for and select your **_Callback Function_** name.&#x20;
3. In the second drop-down, select _Status_.&#x20;
4. Keep the third drop-down set to _==_.
5. From the final drop-down, select _OK_. This corresponds to an `onSuccess` result.
6. Select the **Yes path** radio button. This routes the Workflow along the Yes path when the callback returns `onSuccess`.
7. Click **Save condition**.
   <Callout icon="📌" theme="default">
     ### Example

     ![](https://files.readme.io/caba51a9b5dd5823903903c26fa0204be19ed2619462f61654a0f64556de4cd7-image.png)
   </Callout>

### 2. Condition for `onFail` and `onUnknown`

The following steps detail the Condition configuration for the `onFail` and `onUnknown` paths.

1. Drag a second Condition into the builder. Connect it to the **No** side of the first Condition, before the result node.
2. In the first drop-down, search for and select your **_Callback Function_** name.
3. In the second drop-down, select _Status_.
4. Keep the third drop-down set to _==_.
5. From the final drop-down, select _UNKNOWN_. This corresponds to an `onUnknown` result.
6. Select the **Yes path** radio button. This routes the Workflow along the Yes path when the callback returns `onUnknown`.
7. Click **Save condition**.

<Callout icon="📌" theme="default">
  ### Example

  ![](https://files.readme.io/5f21ede23de9e8d51394fa62e7ea3f40b4103e15a1ee54f53a963b0f89b5d9a3-image.png)
</Callout>

By default, both the Yes and No paths of the second Condition connect to a Session Failed result node. Update the Yes path result node to reflect your step-up flow:

1. Click the three dots on the result node connected to the **Yes path** of the second Condition.
2. From the **Select Decision** menu, select _Manual Review_.
3. Click **Update Decision**.

<Callout icon="📌" theme="default">
  ### Example

  Following this configuration, your Workflow builder should look like this:

  ![](https://files.readme.io/2d5e3541f6b27e122a1fe811f09b89d585cf09ba82dd3b99370ef48d1eeaf372-image.png)
</Callout>

<br />
