> For the complete documentation index, see [llms.txt](https://docs.criticalmoments.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.criticalmoments.io/actions-in-app-messaging/conditional-actions.md).

# Conditional Actions

Conditional actions are a meta action type which check a [condition](/conditional-targeting/intro-to-conditions.md) and dispatch one action if it's true, and another if it's false.

{% hint style="info" %}
Example use case: If the app\_version >= 3.0, show a modal message about new v3 features. If not, show alert suggesting they upgrade, including a button which links to the app store.
{% endhint %}

### Configuration

The following fields are available in the action configuration:

* `condition` \[string, required]: the [condition](/conditional-targeting/intro-to-conditions.md) to check. Example `(device_battery_state == 'charging' || device_battery_state == 'full')`.
* `passedActionName` \[string, required]: the name of the action to fire if the condition is true.
* `failedActionName` \[string, optional]: the name of the action to fire if the condition is false.

{% hint style="info" %}
If you don't have an "else"/`failedActionName` action and just want to check a condition before firing an action, you don't need to wrap your action in a conditional action. Simply specify a [`condition` string on the action](/actions-in-app-messaging/actions-overview.md) and the action will only proceed if the condition passes.
{% endhint %}

### Example Config

```
{
    "actionType": "conditional_action",
    "actionData": {
        "condition": "(device_battery_state == 'charging' || device_battery_state == 'full')",
        "passedActionName": "true_action",
        "failedActionName": "false_action"
    }
}
```
