Critical Moments Docs
Quick StartHomepageAccount
  • Documentation Home
  • What is Critical Moments?
  • Quick Start
  • Concepts Overview
  • Remote Control / Service
    • Host Config on Github Pages
  • Config File Structure
  • Demo App
  • Homepage & Account
  • 📚Guides
    • Mobile App Toolbox: 13 Features Most Apps Need
    • Reduce App Churn with Notifications
    • Improve your App Store Rating
    • Feature Flags Guide
  • ⏰Notifications
    • Intro to Notifications
    • Notifications Spec
    • Smart Delivery
    • Badges
  • 🎯Conditional Targeting
    • Intro to Conditions
    • Built-in Properties
    • Custom Properties
    • Syntax and Operators
    • Conditional Guides
      • Working with Dates
      • Locations and Weather
      • Event and Property History
  • 🎪Events
    • Event Overview
    • Recommended Events
    • Built-In Events
  • 💬Actions / In App Messaging
    • Actions Overview
    • Modals
      • Modal Content Sections
      • Modal Buttons
      • Modal Images
    • Banners
    • Alerts
    • App Reviews
    • Open Link
    • Custom Actions
    • Conditional Actions
    • Triggers
  • 🎨Themes
    • Theme Overview
    • Built In Themes
  • ⛳Feature Flags
    • Feature Flag Guide
    • Conditional Feature Flags
    • Named Conditions Config
  • 🔑Trustless SaaS
  • 👋Support
  • 👩‍💻SDK API Reference
Powered by GitBook
On this page
  • Configuration
  • Example Config

Was this helpful?

  1. Actions / In App Messaging

Conditional Actions

If this, then that

Last updated 1 year ago

Was this helpful?

Conditional actions are a meta action type which check a and dispatch one action if it's true, and another if it's false.

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.

Configuration

The following fields are available in the action configuration:

  • condition [string, required]: the 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.

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 and the action will only proceed if the condition passes.

Example Config

{
    "actionType": "conditional_action",
    "actionData": {
        "condition": "(device_battery_state == 'charging' || device_battery_state == 'full')",
        "passedActionName": "true_action",
        "failedActionName": "false_action"
    }
}
💬
condition
condition
condition string on the action