Proteggiamo il tuo ambiente digitale da qualsiasi attacco informatico. Sfrutta tutte le potenzialità della piattaforma SGBox!

Gallery

Contatti

Via Melchiorre Gioia, 168 - 20125 Milano

info@sgbox.it

+39 02 60830172

Search another article?

You are here:
< Back

Use IF condition on playbook response

List of operators that can be used to compare the 2 values of a condition:

  • Equals: returns TRUE if Value 1 = Value 2
  • Greater than: returns TRUE if Value 1 > Value 2
  • Greater or equal: returns TRUE if Value 1 >= Value 2
  • Less than: returns TRUE if Value 1 < Value 2
  • Less or equal: returns TRUE if Value 1 <= Value 2
  • Contains: returns TRUE if Value 2 is contained into Value 1 as a string. E.g.: Playbooks contains book
  • Starts with: returns TRUE if Value 2 is at the beginning of Value 1. E.g. Playbooks starts with Play
  • Ends with: returns TRUE if Value 2 is at the end of Value 1. E.g. Playbooks ends with books
  • Belongs to a set: being Value 2 a set of comma-separated values, returns TRUE if Value 1 belongs to Value 2. E.g. play belongs to books,play,playbooks
  • Match with regexp: being Value 2 a regular expression, returns TRUE if Value 1 matches with Value 2. E.g. playbooks matches with .*book.$

Example – IF node reading a value from an API

Playbooks - IF condition

Sends a different mail if the value Number read from the API is smaller or greater than 10.

Playbooks - IF condition

For Value 1, we selected Extract from previous output and chosen the node Api Request. From the output of API Request (a JSON), we selected the key to get the value to test.
Value 2 is fixed at 10.
We use Less than as operator.

Playbooks - IF condition

The response is TRUE because 7 <= 10. The node Mail <= 10 will be run, while Mail > 10 will be ignored.

Download the PB module – samples package for examples.