The One-time password generation block creates a unique code and associates it with a user ID, for example, a phone number or mail. This may be required for registration via a form on the site, order confirmation in an online store or payments.
To make the One-time password generation block receive a request from an external service, use the Incoming webhook block. To verify then this password when the user enters it, use the Verify one-time password block.
How to set up the block
- In the Script editor, select the One-time password generation block and add it to the workspace.
- Enter the contact ID: phone number, email or other data that the external service requests from the user. You can enter a variable in the field.
- Set the password life time - after this time expires, the password becomes irrelevant. The minimum time is 60 seconds. To remove the password lifetime limit, type infinity.
- Set the password length - specify the number of characters. The maximum password length is 20 characters, the minimum length is 4 characters.
- To send a password to a user, use the Send message* block. Enter two curly braces in the text box, click Block results and select the result "data.password" of the One-time password generation block.
Script example
The user enters the phone number into the registration form on the site. The Incoming webhook block will pass the information to the chatbot, the One-time password generation block will create a password, and the Send message* block will send it to the user in messenger.