Extend router process
  • 07 Jun 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Extend router process

  • Dark
    Light
  • PDF

Article summary

When the authorization process is ready, configure the validation that the user is authorized in the bot:

  1. In the Router Process:

    1. Add the Set Parameter node between the GET last_command & process_id and Check Command nodes.
    2. Use the CONV function to set up receiving the phone parameter from the User Profile State Diagram.
    3. If the phone number receiving procedure failed, record the phone: “” value.

    Router process

  2. In the Check Command node:

    1. Add validation for having a phone number kept using the phone: “” construction.
      Note: If this validation succeeded, the parameter has a blank value of phone: “”.

    2. Direct the task into the Set Parameter node, and use the command: /auth statement to assign the /auth value to the command parameter.

    3. 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.

    Check Command node

  3. Between the Delete callback and text_id = main menu nodes:

    1. 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 of phone: “”.

    2. Direct the task into the Set Parameter node, and use the command: /auth statement to assign the /auth value to the command parameter.

    3. 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.

    Delete callback node

We set up the validation whether a user is authorized or not.

Note:
  • 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.

Was this article helpful?