If else condition

This section describes the If else condition in Quickwork which allows you to implement conditional logic to make your journeys more dynamic and responsive.

In an If else condition, if the condition is true, one set of actions is executed; if false, a different set of actions is triggered. The block of actions configured after the If else condition are executed regardless of the condition's result.

Consider a use case wherein the If else condition can be utilized to optimize the handling and notification process on Slack based on the product's price when a new product is added via Shopify. By implementing conditional logic, the journey is defined such that notifications are tailored and dispatched to the appropriate team members in real-time, depending on specific criteria related to the new products.

Pre-requisites

  • Access to Quickwork.
  • Basic understanding of Quickwork terminologies and familiarity with Quickwork's GUI.
  • Experience in creating, executing, and managing a journey effectively from start to finish.
  • If you want to try out this specific use, you need:
    • A Shopify account with an active store.
    • An active Slack workspace with channels high-value-orders and general-orders.

Building the journey using If else condition

The following steps describe the use case of utilizing if else condition to automate product notifications in Slack based on price thresholds with Shopify.

  • Trigger: Utilize the Shopify - Product added or updated trigger event to detect when new products are added to your store.
  • Action: Implement the If else conditional logic within the journey to differentiate notifications based on specific product criteria:
    • If condition: Check if the new product's price exceeds a predetermined threshold. If the condition is true, configure Slack to send a high-priority notification with detailed product information to the high-value-orders channel designated for high-value items.
    • Else condition: If the product's price does not meet the threshold, configure Slack to send a standard notification to a general-orders channel, providing essential details about the new product entry.

Now, let us create the journey.

  1. Set up the Shopify trigger: Go to the Event section, select Shopify (Private App), and pick the Product added or updated from the Trigger Event drop-down.
  1. Connect your Shopify account by choosing an existing connection or creating a new one. To set up a new connection, click + Create new connection link and follow the prompts to link your Shopify account.

  2. Configure the If else condition:

    1. In the Steps section under Business Logic, choose If Else Condition.
    1. In the If condition block, place the Price data pill from Shopify | Product added or updated (Data Tree Output) in the Left Value field.
    2. Set the Condition to Greater than and specify a significant price point (for example, 1500) in the Right Value field.
  1. Configure action for If condition:
    1. Click Please choose an action bar. From the App list, select Slack.
    2. From the Action list, select Send message to channel.
    3. If you have your Slack account connected, click Select an existing connection and choose the connection. Alternatively, to set a new connection, click + Create new connection link. Follow the prompt to set up the connection.
    4. After the successful connection, select the high-value-orders channel from the Channel list.
    5. In the Message input field, place the Product Id, Title, and Price data pill from Shopify (Private App) in the Data Tree Output.
    6. Fill any other non-mandatory fields if you want to.
  1. Configure action for Else condition:
    1. Click Please Choose an action bar. From the App list, select Slack.
    2. From the Action list, select Send message to channel.
    3. Select the general-orders channel from the Channel list.
    4. In the Message input field, place the Product Id, Title, and Price data pill from Shopify (Private App) in the Data Tree Output.

Testing and executing the journey

  1. Click Save & Start to activate your setup and initiate the journey.
  2. Test the journey by adding new products in Shopify.
  1. Check Slack notifications. Ensure notifications are correctly posted in the designated Slack channels based on the product's price.

This optimized journey not only enhances the efficiency of product handling by utilizing advanced triggers and conditions but also ensures that your team remains well-informed about new product additions in real-time, improving response and engagement.

Troubleshooting

  • Condition not meeting: Verify that the Price data pill is correctly received from Shopify. Check that the price criteria (for example, 1500 ) are correctly set.
  • Incorrect execution of If else paths: Test with multiple scenarios to ensure both high-value-orders and general-orders notifications are triggered appropriately. Confirm the logic paths are not overlapping or misconfigured.
  • Missing Slack notifications: Ensure that the Slack connection is correctly configured. Verify that the channels (high-value-orders and general-orders) exist and the Slack integration has the necessary permissions to post messages.
  • Incorrect channel notifications: If notifications appear in the wrong channels, check the mapping in the Slack actions within the If and Else blocks.

✏️ Tips and recommendations

  • Continuously test new scenarios as you add products in Shopify to ensure the journey reacts appropriately under various conditions.
  • Enhance Slack notifications by adding attachments or formatted messages that include images of the product, links, or additional metadata to provide more context in the notifications.

📚 Additional resources

Simple action vs Business logic
Build your first journey
If condition
If condition using AND/OR operator
Foreach loop
Try-catch error handling
Stop journey