How to make a bot script private

Password validation

Let's start with validation as it works similarly for any method. It's implemented with Fork. Set up the screen as in the screenshot:

Generating random password

At the beginning, Assign a variable component sets a random numeric password. We use Haldlebars helper {{random 16458 78965485}} which sets variable to a random number between the two specified numbers. The same variable will have a unique number for each user. We set the variable to password. To check the password, in the Fork we output the variable as text: {{password}}.

Thus a unique value is assigned for each user that he must input. This value can be seen in the user-specific variables. It is possible to send a message with the password by outputting {{password}} variable.


In the example, users who have entered a password that matches the value of their password variable will be forwarded to Password Correct screen. Otherwise, Default Target will be triggered and the user will be forwarded to Password Incorrect screen.

The randomly generated password must be delivered. The easiest way to do this is by email. Optionally, for example, you can integrate it with sms.ru and send it via SMS.

Open access after payment

One of the frequent tasks is to show certain sections to the user only after they make the payment, in such a way that free sections are preserved as well. In this case it might be trickier than just giving out access password.

For example, you can split up the menu. This can be done in a few steps:

1. If the payment was successful , write ok to paid variable. This marks that the user has paid for access.

2. In Bot Menu screen, put Assign a variable component at the beginning. Set {{paid}} to paid. This way paid variable is created for the user even if they text the bot for the first time.

3. Place Fork afterwards. It gets the value from paid variable. Data Type in Target is Text, the value is okay, transition is set to Paid Menu. The Default Target is set to Transition to Free Menu screen.

4. Add buttons to both screen that will take user to relevant screens

To revoke access when the paid period ends, set up a Trigger event. A screen will be sent with paid variable set to {{\null}}.

To the beginning ↑