Use a Condition


You can use conditions in flows and templates. Conditions are a powerful tool, with them you can easily target your communications.

Using conditions in a flow

For this example, we have download the apps Open Weather and SMTP Emails, we have mapped the response of Open Weather to our data schema, created an interface to authorize the request and set an email template in the content section.

Having that, we can go to flow section and create a simple one so we can see how conditions works:

  1. We add Open Weather to the flow.
  2. We configure it, so we get the desired weather information.
  3. We add the email app to the flow.
  4. We set the template we have created for this purpose and the rest of the parameters in the SMTP Email configuration.
  5. Now we can insert our previously created condition or we create it here using decision objects that we can find on system tag (where dynamic decision is to set a new condition and generic decision is to choose an existing one).
  6. Now we can link each object as follows. As we can see, the flow will check the weather and with the information retrieved it will cross or not our condition. If it matches our condition an email will be sent, otherwise not.
  7. We’ve set the condition as follows: check the temperature received in the Open Weather API call and give a TRUE/YES if it is less than 15.
  8. We can click on “Test Data” button to see our flow working.

In this example, if temperature is lower than 15ºC we will receive this email:

Using a Condition in a template

In this case we will just edit the HTML template we have created for previous example and create a new condition. We will add an advice to the email if it is cloudy.

    1. We create our new condition as follows: we check if it is cloudy in more than 70%.
    2. Now we can go to Content Layout / Templates and click to edit the template.
    3. We create a new paragraph and click on Tools / Conditions.
    4. Setting the cursor in the new paragraph opening tag and having selected our new condition in the drop-down list, we click on the “Add” button.
    5. An HTML attribute will be created. Now we can add some text that only will appear if the condition is met.
    6. Save the template, go to Content section and create a new HTML with it (don’t forget to Publish it in order to have it available for the flow).
    7. Running again our flow, selecting our new HTML Content in SMTP Email object, we will receive the following message, only in case it is cloudy, otherwise the message will look like before.