Skip to main content

12.01 Using routes with filter conditions

As an example, let's create a scenario, where the input parameters are numerical values and the outcome is one of two messages:

  • "The provided value is greater than 1000" - if a number greater than 1000 is given as input.
  • "The provided value is less than or equal to 1000" - if a number less than or equal to 1000 is given as input.

You will need to add 4 nodes and two routes containing filtering conditions for the scenario to work successfully:

  • (1)Trigger on Webhook node to which a POST request is sent with a URL that contains a value;
  • (2)JavaScript node that converts the passed value into a constant;
  • (3)Webhook Response node named "Greater than 1000" that returns the message "The provided value is greater than 1000";
  • (4) A route between the JavaScript node and the Webhook Response node "Greater than 1000" with a filter condition set to {{2.Value > 1000}};
  • (5)Webhook Response node named "Less than 1000" that returns the message "The provided value is less than or equal to 1000";
  • (6) A route between the JavaScript node and the Webhook Response node "Less than or equal to 1000" with a filter condition set to {{2.Value <= 1000}}.

The result of executing the scenario is the corresponding message:

  • If a value less than 1000 is passed as input parameters, the scenario execution proceeds through the "Less than or equal to 1000" route, and the response to the scenario execution is sent by the Webhook Response node "Less than 1000";
  • If a value greater than 1000 is passed as input parameters, the scenario execution proceeds through the "Greater than 1000" route, and the response to the scenario execution is sent by the Webhook Response node "Greater than 1000."