If

1. Description

It is a conditional component designed to test conditions. It allows you to compare a value and what you expect logically.

This component is present in flow types like:

  • Voice;
  • Chat;
  • Forms;
  • Service.

The block (Fig.1(1)) is used in space to build the Flow. The settings panel for this component opens (Fig.1(2)) when you click on the block.

Fig.1. If component

1.1. If block

The block consists of the following elements:

  1. The name of the component;
  2. in branch - receiving (connecting with the previous block) branch;
  3. then branch - execution of the Flow scheme on this branch occurs when the condition specified in the Expression field is met;
  4. else branch - execution of the Flow scheme on this branch occurs when the condition specified in the Expression field is not met;
  5. out branch - the execution of the Flow scheme on this branch occurs after the execution of the scheme on the then or else branches. Outgoing (connecting to the next block) branch. 

1.2. If settings panel

It consists of the following elements:

  1. Expression;
  2. Break;
  3. Add limit.

1.2.1. Expression

The test condition is entered here.

All variables in Webitel are marked like this - ${ }. The variable name is enclosed in curly braces. The next step is to specify the condition.

For example, it is necessary to check whether the variable out_w is more significant than zero. The field entry will look like this:

${out_w}>0 

If the condition is met, the then branch is used.

The else branch is used if the condition is not met.

 Using If to Time of Day Routing

Time-of-day routing allows calls to be executed in different applications based on the time and day of the week. 
You can use it in the different conditional statements.


&minute_of_day (minutes)

Arguments:

  • minutes (string) – Minute of the day, (1-1440) (midnight = 1, 1am = 60, noon = 720, etc.).

Returns:

  • true, false, or the minute of the day if there are no parameters

&time_of_day (08:00-17:00)

Arguments:

  • time (string) – Time range formatted: hh:mm[:ss]-hh:mm[:ss] (seconds optional).

Returns:

  • true, false, or the time of the day if there are no parameters

&minute (minutes)

Arguments:

  • minutes (string) – Minute (of the hour), 0-59.

Returns:

  • true, false, or the minutes of the hour if there are no parameters

&hour (hours)

Arguments:

  • houres (string) – Hour, 0-23.

Returns:

  • true, false, or the hour of the day if there are no parameters

&wday (wdays)

Arguments:

  • wdays (string) – Day of the week, 1-7 (Sun = 1, Mon = 2, etc.) or “sun”, “mon”, “tue”, etc.

Returns:

  • true, false, or the day of the week if there are no parameters

&mweek (mweeks)

Arguments:

  • mweeks (string) – Week of the month, 1-6.

Returns:

  • true, false, or the week of the month if there are no parameters

&week (weeks)

Arguments:

  • weeks (string) – Week of the year, 1-53.

Returns:

  • true, false, or the week of the year if there are no parameters

&mday (mdays)

Arguments:

  • mdays (string) – Day of the month, 1-31.

Returns:

  • true, false, or the day of the month if there are no parameters

&mon (m)

Arguments:

  • m (string) – Month, 1-12 (Jan = 1, etc.).

Returns:

  • true, false, or the month if there are no parameters

&yday (d)

Arguments:

  • d (string) – Day of the year, 1-366.

Returns:

  • true, false, or the day of the year if there are no parameters

&year (y)

Arguments:

  • y (string) – Calendar year, 0-9999.

Returns:

  • true, false, or the year if there are no parameters
Example code:
{
  "if": {
    "expression": "&hour(18-20) && &wday(2-6)",
    "then": [
      {
        "setVar": "time_now=&time_of_day()"
      }
    ]
  }
}

1.2.2. Break

Responsible for the completion of the flow execution.

- initiates the end of the flow execution after the given component.

- the switch is in the off position.

1.2.3. Add limit

It is intended to determine the maximum number of passes through this component.

The failover branch appears in the edited component when the limit is set .

The failover branch will be used if more passes are passed through the component than entered in the Max field.

Clicking on the Add Limit button adds a Max field and a Delete limit button.

The number of possible passes is indicated in the Max field.

Clicking on the Delete limit button removes the limit and returns the Add limit button.

Fig. 2. Setting a limit