How to setup string conditions in Apilio

Apilio allows you to store text so you can create conditions that use this information. For example, you could store tomorrow’s weather forecast in a string variable and react differently, perhaps with a special alert or turning on the heater earlier than usual, if there is rain or snow expected the following day.

A string variable can store things like: “Heavy rain”, “London”, “Bobbie”.

Create a string variable and update it

You can create a string variable going to https://app.apilio.com/string_variables and click/tap on “new variable”. You can add a name, the current value that you wish to store in the string, and add tags if you wish to keep things grouped and organised.

String variables can be updated via webhooks or IFTTT.

Different types of string comparisons

image

We are going to use the variable Weather for a few examples. This variable is currently set to “Heavy rain” by the weather service in IFTTT. When creating a string condition, you’ll be able to set a string to compare your variable against. The string is a constant value that will be compared against your variable. The variable is usually kept updated with an external service that sends information to Apilio.

A couple of important notes to remember is that:

  1. Apilio uses whitespaces to separate words, you’ll be reminded of this where you enter your comparison string.
  2. Apilio matches text on any case: for example RAIN is equal to rain.

Contains

The comparison string has a word that is included in the variable. There might be other bits of text in the variable, for example:

  • Variable: “heavy rain”
  • Comparison string: “rain”
  • Variable “heavy rain” contains “rain” = this condition is true

Does not contain

The comparison string specifies a word or sentence that should not be present in the

  • Variable: “heavy rain”
  • Comparison string: “rain”
  • Variable “heavy rain” does not contain “rain” = this condition is false, because the variable does contain “rain”

Matches exactly

This comparison is helpful if you want to only get a condition to be true when the string is an exact match of another string.

  • Variable: “Heavy rain”
  • Comparison string: “Heavy rain”
  • Variable “Heavy rain” matches exactly “Heavy rain” = this condition is true

Does not match exactly

This comparison is helpful when you want to have a condition that is always true except in one case: when the string and the variable are exactly the same, this is the only case when the comparison is false. It will be true in any other case.

  • Variable: “Heavy rain”
  • Comparison string: “rain”
  • Variable “heavy rain” does not match exactly “rain” = this condition is true

:bulb: Related articles

2 Likes