> For the complete documentation index, see [llms.txt](https://docs.ownchat.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ownchat.app/bot/utility/switch-case.md).

# Switch Case

The **Switch Case** action allows chatbot builders to create **advanced conditional routing** logic inside chatbot workflows.

This utility action checks whether an input value matches a defined condition and automatically triggers the appropriate workflow action based on the result.

Unlike standard IF conditions, **Switch Case** is designed for handling **multiple matching scenarios** more efficiently using condition types such as:

* Equals To
* Contains

The walkthrough demonstrates configuring Switch Case logic using customer fields, exact matching, contains conditions, case-sensitive validation, variables, and workflow branching.

{% embed url="<https://app.supademo.com/demo/cmn4bwnuy0qeaz3qmkz2koxrq?utm_source=link>" %}

### When to Use Switch Case &#x20;

Use the Switch Case action when your chatbot workflow needs to handle multiple input matching conditions dynamically.

### Common Use Cases &#x20;

* Customer name validation
* Company name matching
* Department routing
* Lead qualification
* Keyword-based workflow routing
* Dynamic customer segmentation

**Example Interaction** &#x20;

Input:\
ABC Company\
\
Condition:\
Contains → Company\
\
Result:\
Trigger next workflow action

The chatbot automatically routes the workflow when the condition matches.

### How to Add Switch Case &#x20;

Follow these steps to add the **Switch Case** action to your bot workflow.

1. Open **Bot Builder**
2. Click the **Add Node** button
3. Open the **Utilities** tab
4. Select **Switch Case**
5. Configure the condition settings
6. Add variables or additional conditions if required
7. Click **Create**
8. Click **Publish** to deploy the workflow

The walkthrough demonstrates selecting the Switch Case action from the Utilities section.

### Accessing the Utilities Section &#x20;

To access the Switch Case action:

1. Click **Add Node**

{% embed url="<https://app.supademo.com/demo/cmpb16x0j0003yl0jzc5t7u6c?utm_source=link>" %}

2. Open the action selection panel
3. Click the **Utilities** tab<br>

{% embed url="<https://app.supademo.com/demo/cmpb183ol0009yl0jm6pbodpg?utm_source=link>" %}

The Utilities section contains workflow logic and automation actions.

### Selecting Switch Case &#x20;

Inside the Utilities tab:

1. Locate **Switch Case**<br>

{% embed url="<https://app.supademo.com/demo/cmpb199ei003n0k0j2to71895?utm_source=link>" %}

2. Click the action to open the configuration panel

The walkthrough highlights the Switch Case element used for configuring advanced conditional workflows.

### Switch Case Configuration &#x20;

When configuring the Switch Case action, several fields must be completed.

#### Action Name &#x20;

The **Action Name** identifies the Switch Case workflow inside the bot builder.

This name is visible only within the workflow editor.<br>

{% embed url="<https://app.supademo.com/demo/cmpb1alwx003p0k0j9qzn6yh5?utm_source=link>" %}

**Example** &#x20;

Customer Name Check\
Company Validation\
Lead Routing

The walkthrough demonstrates renaming the default value to:

Case

before saving the configuration.

### Condition Type &#x20;

The **Condition Type** field defines how the chatbot should compare the input value.

Available options shown in the walkthrough include:

* Equals To
* Contains

#### Equals To &#x20;

The Equals To condition checks for an exact match between the input value and the configured value.

{% embed url="<https://app.supademo.com/demo/cmpb1bnue086bxa0jo7c4lflg?utm_source=link>" %}

Example:

Input = Dheva

The condition succeeds only when the values match exactly.

#### Contains &#x20;

The Contains condition checks whether the input includes a specific word or phrase, even if additional text exists.

{% embed url="<https://app.supademo.com/demo/cmq0e6gij00ltyc0j9h33lv1z?utm_source=link>" %}

**Example:**

Input:\
ABC Company Private Limited\
\
Condition:\
Contains → Company

The condition succeeds because the word **Company** exists inside the input value.

### Case Sensitive Option &#x20;

The **Case Sensitive** toggle determines whether the condition should consider uppercase and lowercase characters during comparison.<br>

{% embed url="<https://app.supademo.com/demo/cmpb1czaw07mmz70jhkry6mp7?utm_source=link>" %}

#### When Enabled &#x20;

The value must match the exact letter casing.

Example:

Input: Dheva\
\
Condition Value: dheva\
\
Result: Fail

#### When Disabled &#x20;

The comparison ignores uppercase and lowercase differences.

Example:

Input: Dheva\
\
Condition Value: dheva\
\
Result: Success

The walkthrough demonstrates enabling and disabling the Case Sensitive option.

### Input Value &#x20;

The **Input Value** field specifies the customer field or variable that should be evaluated.

To configure:

1. Open the **Input Value** dropdown
2. Select the required customer field

The walkthrough demonstrates selecting:

name

from the available customer fields.

Other available fields shown include:

* Lead Status
* Email
* Tags
* WhatsApp Name
* Contact Source<br>

{% embed url="<https://app.supademo.com/demo/cmpb1m7af00fxu40jmeblnm2g?utm_source=link>" %}

#### Value Field &#x20;

The **Value** field defines the expected comparison value for the Switch Case condition.

**Example** &#x20;

Dheva

The chatbot compares the selected input field against this value.<br>

{% embed url="<https://app.supademo.com/demo/cmpb2umrv00nzu40jwusnlwdh?utm_source=link>" %}

### Add New Condition &#x20;

To create additional conditions:

1. Click **Add New Condition**

{% embed url="<https://app.supademo.com/demo/cmr1nrf3j00bnw60jefn83uz6?utm_source=link>" %}

2. Configure another condition block
3. Repeat as needed

This allows multiple matching conditions to be handled within the same Switch Case workflow.

### Adding Variables &#x20;

You can dynamically insert variables into the Value field.

To add a variable:

1. Click **Add Variable**<br>

{% embed url="<https://app.supademo.com/demo/cmpb2ztkm00o7u40jdqpqwny7?utm_source=link>" %}

2. Select the required variable or customer field
3. Insert the variable into the Value field

{% embed url="<https://app.supademo.com/demo/cmpb31bsw00o9u40jgu7i05k1?utm_source=link>" %}

The walkthrough demonstrates selecting:

name

from the customer fields list.

The inserted variable appears as:

{{customer.name}}

inside the Value field.<br>

{% embed url="<https://app.supademo.com/demo/cmpb31bsw00o9u40jgu7i05k1?utm_source=link>" %}

### Removing Variables &#x20;

If a variable is no longer required:

1. Click the **Delete** icon

{% embed url="<https://app.supademo.com/demo/cmpb32kxb0766z80jpy8rg4p4?utm_source=link>" %}

2. Remove the selected variable from the condition

The walkthrough demonstrates removing unwanted variable conditions using the delete action.

### Dynamic Value Toggle &#x20;

The **Is Dynamic Value** toggle determines whether the value should be:

* Dynamically generated\
  or
* Entered manually as a static value

The walkthrough demonstrates using both static and dynamic matching configurations.

### Creating the Switch Case Action &#x20;

After configuring all conditions:

1. Review the matching logic
2. Click the **Create** button<br>

{% embed url="<https://app.supademo.com/demo/cmpb34p2h08a2z70jrjk76prj?utm_source=link>" %}

The Switch Case node will now appear in the workflow canvas.

### Workflow Behavior &#x20;

Once triggered, the **Switch Case** action:

* Evaluates input values dynamically
* Supports exact and partial matching
* Handles multiple conditions
* Supports case-sensitive validation
* Triggers workflow routing automatically

The walkthrough demonstrates both **Equals To** and **Contains** condition logic for customer and company validation workflows.

***

### Example Workflow &#x20;

#### Example Chatbot Workflow &#x20;

Collect Customer Name\
&#x20;       ↓\
Switch Case\
&#x20;       ↓\
Condition:\
Contains → Company\
&#x20;       ↓\
Trigger Business Workflow

**Example Interaction** &#x20;

Customer Input:\
ABC Company

{% embed url="<https://app.supademo.com/demo/cmpb3c7lk00p0u40jdvaqutp7?utm_source=link>" %}

\
Condition:\
Contains → Company\
\
Result:\
Business Workflow Triggered

The chatbot automatically routes the customer based on the configured matching condition.

### Creating the Switch Case Action &#x20;

After configuring all conditions:

1. Review the matching logic
2. Click the **Update** button<br>

{% embed url="<https://app.supademo.com/demo/cmpb3d8eo000ry60joxgkp3zp?utm_source=link>" %}

### Publishing the Bot Changes &#x20;

After configuring the Switch Case workflow:

1. Review all configured conditions
2. Click the **Publish** button<br>

{% embed url="<https://app.supademo.com/demo/cmpb3ffne00pau40j3c098308?utm_source=link>" %}

3. Deploy the updated workflow to production

The walkthrough concludes by publishing the configured Switch Case logic successfully.

### Best Practices &#x20;

Follow these recommendations when using **Switch Case.**

### Use meaningful action names &#x20;

Clearly identify the purpose of the routing logic.

#### Choose the correct condition type &#x20;

Use:

* **Equals To** for exact matches
* **Contains** for partial matching

### Configure case sensitivity carefully &#x20;

Enable case sensitivity only when exact letter casing matters.

### Keep conditions organized &#x20;

Avoid overly complex matching logic inside a single workflow.

### Test all matching scenarios &#x20;

Validate every condition before publishing the bot.

### Summary &#x20;

The **Switch Case** action allows chatbot builders to create **advanced input-based routing workflows inside Ownchat.**

With **Switch Case**, you can:

* Match exact or partial values
* Handle multiple workflow conditions
* Use dynamic customer variables
* Enable case-sensitive validation
* Automate conditional workflow routing

This utility action helps businesses build **smarter chatbot decision-making and dynamic workflow automation within Ownchat.**
