How to send Trigger events daily, excluding weekends

This scenario will be useful if the user needs to receive a broadcast with Trigger event every working day, except for weekends - Saturday and Sunday.

1. On Start screen, add a tag with the name "Lesson".

When testing this case, it is recommended to delete the existing tag, as well as clear all user variables before adding a tag to the component. Due to this, when the bot is restarted, the user will be perceived as a new one.

No messages will be sent to the user on Start Screen, and there are also no transitions to other screens, since the rest of the scenario will be carried out with Trigger Event.

Start screen should look something like this:

2. Add the Day of the week check screen. At the last stage, we will add this screen to the Trigger Event settings, and now we are going to deal with its design.

  • Delete and re-assign tag. If user tag are updated by deleting the old tag and assigning a new tag to the next component, Trigger event will be triggered as many times as tag will be re- assigned. Therefore, in this case, the tag is deleted every time before a new assignment.
  • Let's add Assign a variable. In the value of the dn variable, write a helper to determine the ordinal number of the day of the week:
  • {{formatDate "d"}}
        
  • Next, in the Fork, check this serial number in order to separate the users who received Trigger on weekends and working days on different screens.
  • Add the dn variable to the "Variable name, where Fork will take the value" ‎field.
  • In the Fork settings, add one target with the Regular Expression data type and add a regular expression for numbers from one to five:
  • ^[1-5]$
        
  • Such a regular expression will transfer a user with the value of the dn variable in the range from one to five to the "Fork by days" screen.
  • Let's add a transition for the default Goal to the Saturday and Sunday screen. Since the lessons are not sent these days, there should not be a single component on this screen.

3. Set up the " The fork of the day" screen:

  • Add the day variable with the {{day}} value. We will check this variable further in Fork. The serial number of the screens or lessons to be sent will be recorded in day.
  • Let's add day to the field for the variable, where the fork will take the value.
  • The number of goals corresponds to the number of lessons. In our example, there are 10 lessons, so we will create 9 goals and one Default goal for the first day, because on the first day of the broadcast, the user does not have a verifiable variable.

In Goal 1, there should be the value 1 and transition to the screen with the second lesson, in Goal 2, there should be the value 2 and transition to the screen with the third lesson, in Goal 3, there should be the value 3 and transition to the screen with the fourth lesson, etc.

4. Create 10 screens according to the number of lessons. We will assign a variable to each screen with a value that corresponds to the lesson number. In addition, the text, which will be sent to the user on each of the working days, will be added to each of these screens.

5. Design the screen for the final broadcast separately. On this screen, we delete all user variables and tag. This is necessary so that after sending the last lesson, the Trigger event will no longer be triggered and lessons will not be sent.

6. Create Trigger event that will be sent daily at 9 am. However, if you need to change the time, you can specify the desired time to send.