---
title: "Using Conditional Paths to Customize Automations"
description: "Using Conditional Paths to Customize Automations"
url: "https://www.contentstack.com/docs/developers/automation-hub-guides/using-conditional-paths-to-customize-automations"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2024-05-14"
---

# Using Conditional Paths to Customize Automations

This use case covers a scenario where you can execute an Automation based on a conditional path. The conditional path configurations are checked, and if the condition is true, the **If** step actions are executed, otherwise the **Else** step actions are executed.

Creating a new entry triggers the automation, and the conditional path configurations are checked. If the condition is true, the If step will execute the Slack connector that will send a message to the configured channel.

If the condition is false, the Else step will execute the Transform connector that will fetch the entry details from the trigger and pass these details as an object in Algolia.

Let's break this scenario to see what must be the trigger event and the consequent action required to execute the Automation:

*   **Set up the Contentstack “Entry Created'' Trigger Event:** This trigger event is activated whenever a user creates a new entry in Contentstack and in turn it executes the automation.
*   **Set up the Contentstack “Conditional Path”:** Once the above event triggers the automation, it checks for the configuration provided within the conditional path.
*   **Set up the Slack “Send Message” action for the If step:** When the conditional path configurations are met, the If step action will send a message to the configured channel using the Slack action connector.
*   **Set up the “Transform” action for the Else step:** When the conditional path configurations are not met, the Else step will execute the Transform action which will fetch the entry UID from the entry trigger as a JSON object and entry data will be merged in the final result.
*   **Set up the Algolia “Index Entries” action for the Else step:** Once the transformation is complete, an object will be created in the Algolia index with the same entry UID.

The steps to set up the Automation are as follows:

1.  [Configure Entry Trigger](#configure-entry-trigger)
2.  [Configure Conditional Path](#configure-conditional-path)
3.  [Configure Slack Connector within the If Step](#configure-slack-connector-within-the-if-step)
4.  [Configure Transform Connector within the Else Step](#configure-transform-connector-within-the-else-step)
5.  [Configure Algolia Connector within the Else Step](#configure-algolia-connector-within-the-else-step)

Let’s look at the setup in detail.

1.  ## Configure Entry Trigger
    
    1.  Log in to your [Contentstack account](https://www.contentstack.com/login/) and click the “Automate” icon.
    2.  Click **\+ New Project** to add a new project.
    3.  Click **\+ New Automation**.
    4.  Enter the **Automation Name** and **Description**.
    5.  Click **Create**.
    6.  Select **Configure Trigger** from the left navigation panel.  
        ![Basic-Information-Screen.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt3bc5c6209db0fdda/63d91614f1b8c22282814fe5/Basic-Information-Screen.png)
    7.  Within the **Configure Trigger** step, click the **Contentstack** connector.  
        ![Select\_Contentstack\_Trigger](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt8b37a302def4b1b1/647eff2b07768ff4bb9480d4/Select_Contentstack_Trigger.png)
    8.  Click **Entry Trigger** from the list of trigger events.  
        ![Select-Entry-Trigger.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/bltfec8310acdfaf910/63d9154f35e4be151745b2ec/Select-Entry-Trigger.png)
    9.  Add your Contentstack account. For more information, refer to the [Contentstack Trigger](/docs/developers/automation-hub-connectors/contentstack-trigger/) documentation.
    10.  Select **Entry Created** event from the list of events. Select a **Stack,** and a **Branch** from the **Lookup** dropdown.   
         ![Select\_Different\_Fields](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt47da453ef7967cd5/647f00b778de87ce5ce76d13/Select_Different_Fields.png)
    11.  Once done, click **Proceed**.
    12.  Click **Test Trigger** to test the configured trigger.  
         ![Test-Trigger.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt99a423fdba51f63f/63d9155b17b06010cf2e2f65/Test-Trigger.png)
    13.  On successful configuration, you can see the below output. Click **Save and Exit**.  
         ![Save-Exit.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt6f778da707840a95/63d9153eca59cf11374ceec2/Save-Exit.png)  
         
         **Note:** You can specify trigger conditions that will determine whether the complete automation should run or not. The automation and conditional path will not be carried out if the trigger conditions are not satisfied. You can see the updated list of executions in the Execution Log section
         
2.  ## Configure Conditional Path
    
    1.  Click **Configure Action Step** from the left navigation panel.   
        ![Click-Configure-Action-Step.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt7f81f8f8be9ae5f6/63d915292d94ad4c89edc33a/Click-Configure-Action-Step.png)
    2.  Click **Conditional Path** to configure and set conditions.  
        ![Click\_Conditional\_Path](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt99386839b51f39cc/6453c17c326bc682dd820d8b/Click_Conditional_Path.png)
    3.  Click **+ Add Condition**. In the **Select Input** box, enter the content type UID from the previous step. Select **Matches (Text)**, and provide the UID of the content type in the input box.  
        ![Configuration-Page.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/bltd0beb862f5b80f95/63d9153d3d28dd4dde642662/Configuration-Page.png)
    4.  Click **Save Configuration**.
3.  ## Configure Slack Connector within the If Step
    
    When the conditional path configurations are met, the If step action of sending a Slack message is executed.
    
    1.  Click **\+ Add Step** under the If step from the left navigation panel.  
        ![If-Add-Step.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt626b5d821b5972bd/63d9153d5e9f5911307af0a3/If-Add-Step.png)
    2.  Within the **Configure Action Step**, click the **Slack** connector.
        
        **Note:** You can sort and search the connector(s) based on the filter.
        
        ![Select\_the\_Connector.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt577813da7759c326/6516d079024b467f83de1a91/Select_the_Connector.png)  
        
    3.  Under **Choose an Action**, select the **Send Message** action.  
        ![Select-Slack-Action.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt2ac5689a2c24ddfc/63d91550071fae111ebfd8f2/Select-Slack-Action.png)
    4.  In the **Configure Action** tab, add your Slack account. For instructions on adding your account, refer to the [Slack](/docs/developers/automation-hub-connectors/slack/) connector documentation.
    5.  Select a **Channel** from the **Lookup** list where you want to send the message. Enter the message in the **Message** field.  
        ![Select-message-channel.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt4bbe912273947159/63d91550ddb7a921030a7762/Select-message-channel.png)
    6.  Click **Proceed**.
    7.  Click **Test Action** to test the configured action.  
        ![Test-Slack-Action.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blte8798c2c0603782d/63d9155e771d7f10c63c2a9f/Test-Slack-Action.png)
    8.  On successful configuration, you can see the below output. Click **Save and Exit**.  
        ![Save-Exit-Slack.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt7a54fefc6c14981c/63d9153eca59cf11374ceebe/Save-Exit-Slack.png)
    9.  Once you configure the Slack action, you can add other actions inside the If step using the quick select screen. Similarly, you can also configure Else steps.
        
        **Note:** The quick select next step screen appears only when you have configured an action inside the If-Else step.
        
        ![Next\_Step\_If\_Action](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt1565c01ff82d0b11/646466d90a3fbba7b3ee3a24/Next_Step_If_Action.png)
    
    This sets the **Slack** action connector
    
4.  ## Configure Transform Connector within the Else Step
    
    When the conditional path configurations are not met, the Else step actions of transformation and indexing entries in Algolia are executed.
    
    1.  Click **\+ Add Step** under the Else step from the left navigation panel.  
        ![Click-Else-Step.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt1ca5fc8b3ec4bb78/63d9153d071fae111ebfd8ea/Click-Else-Step.png)
    2.  Within the **Configure Action** Step, click the **Transform** connector.  
        ![Select\_the\_Transform\_Connector.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt2a36219a85158f3e/6516d079024b461d95de1a95/Select_the_Transform_Connector.png)  
        
    3.  Under **Choose an Action**, select the **Transform** action.  
        ![Select-Transform-Action.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt443f661f00fa7f18/63d9154f771d7f10c63c2a9b/Select-Transform-Action.png)
    4.  Click **Add Input**, and enter a variable name for the **Input Name** (say, “ObjectID”) and an **Input Value** configured in the previous step (entry UID) (see the screenshot in next step).
    5.  Click **\+ Add Objects to Merge** and fetch the complete entry details configured in the previous step as shown below.  
        ![Select-Input-Objecttomerge.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt72a2e7098b1ea8cf/63d9154fe480c910d1acb685/Select-Input-Objecttomerge.png)
    6.  In the **Transformation** field, enter the JSON code to fetch the UID value from the **Input Value** field in a variable. You can use the following code format: {“objectID” : “{ObjectID}”}   
        
        ![Transformation-Box.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt9abe4fe2900c3d01/63d9155bc9787852a26be750/Transformation-Box.png) 
    7.  Click **Proceed**.
    8.  Click **Test Action** to test the configured action.  
        ![Test-Transform-Action.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt543dac590ca682d3/63d9155b48166810e8b60d26/Test-Transform-Action.png)
    9.  On successful configuration, you can see the below output. Click **Save and Exit**.   
        ![Save-Exit-Transform.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt4a161feeedcc1698/63d9153e1d043210df6876b9/Save-Exit-Transform.png)
    
    This sets the **Transform** action connector.
    
5.  ## Configure Algolia Connector within the Else Step
    
    1.  Click **\+ Add Step** under the Else step from the left navigation panel.  
        ![Add-Algolia-Step.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt9368032fd4c475c6/63d9152948166810e8b60d1e/Add-Algolia-Step.png)
    2.  Within the **Configure Action** Step, click the **Algolia** connector.  
        ![Select\_the\_Algolia\_Connector.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt386e8a6ca4e143d0/6516d079a452a26db68b3de6/Select_the_Algolia_Connector.png)  
        
    3.  Under **Choose an Action** tab, select the **Index Entries** action.  
        ![Select-Index-Entries-Action.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/bltdda5912c64ca384f/63d9154f5e9f5911307af0a7/Select-Index-Entries-Action.png)
    4.  In the **Configure Action** tab, add your Algolia account. For instructions on adding your account, refer to the [Algolia](/docs/developers/automation-hub-connectors/algolia/) connector documentation.
    5.  Select the **Index Name** where you want to send the data in the form of a list of objects.
    6.  In the **Entries** field, select the entry data fetched from the transform step.  
        ![Select-Algolia-Index-Entry.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/bltf474a533f745a702/63d9154f3f562662ce10abf7/Select-Algolia-Index-Entry.png)
        
        **Note:** Provide your index data as per your object schema and in JSON format only.
        
    7.  Click **Proceed**.
    8.  Click **Test Action t**o test the configured action.  
        ![Test-Algolia-Action.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blt265420dacc3efd4c/63d9155bffb41a7454dbf2b6/Test-Algolia-Action.png)
    9.  On successful configuration, you can see the below output. Click **Save and Exit**.  
        ![Save-Exit-Algolia.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/bltd1ea82cbe53d6777/63d9153d8e456d21046c773a/Save-Exit-Algolia.png)
    10.  Go to the Algolia Index section and check the latest index entry with the data.  
         ![Algolia-Output.png](https://images.contentstack.io/v3/assets/blt2d43f51baca745a8/blta95f3f7ce4bb5577/63d9152804ee8615186bd5e3/Algolia-Output.png)
    
    **Note:** You can view the status of your executions in the Execution Log section.