- 07 Jun 2024
- 1 Minute to read
- Contributors
- Print
- DarkLight
- PDF
Extend router process
- Updated on 07 Jun 2024
- 1 Minute to read
- Contributors
- Print
- DarkLight
- PDF
When the authorization process is ready, configure the validation that the user is authorized in the bot:
In the Router Process:
- Add the Set Parameter node between the GET last_command & process_id and Check Command nodes.
- Use the CONV function to set up receiving the
phone
parameter from the User Profile State Diagram. - If the phone number receiving procedure failed, record the
phone: “”
value.
In the Check Command node:
Add validation for having a phone number kept using the
phone: “”
construction.
Note: If this validation succeeded, the parameter has a blank value ofphone: “”
.Direct the task into the Set Parameter node, and use the
command: /auth
statement to assign the /auth value to the command parameter.Direct the task into the GET process id by state node that will direct the task into the necessary process using the command name for the process_id identification.
Between the Delete callback and text_id = main menu nodes:
Add another Condition node with the same validation for having a phone number kept using the
phone: “”
construction.
Note: If this validation succeeded, the parameter has a blank value ofphone: “”
.Direct the task into the Set Parameter node, and use the
command: /auth
statement to assign the /auth value to the command parameter.Direct the task into the GET process id by state node that will direct the task into the necessary process using the command name for the process_id identification.
We set up the validation whether a user is authorized or not.
- For authorized users, all the bot features are accessible.
- For users not authorized, only authorization is accessible.
- For authorization validation logic, it is possible to use an additional parameter instead of a phone, for example, auth: true/false.