Appearance
OTP - Request code
Use this action to request a one‑time passcode (OTP) for a user. WeWeb automatically generates the code and emits the Event Trigger On OTP requested, so you can send it to the user (such as via email or SMS).
Configuration
| Display Key | Example Input | Description |
|---|---|---|
| "user@example.com" | Recipient email address that will receive the code. | |
| OTP Type | sign-in | Controls the OTP purpose. Valid values: sign-in, email-verification, forget-password. |
WHAT DOES “OTP TYPE” CONTROL?
The OTP Type you select will be used at the verification step. The user’s submitted code must match both the numeric value and the requested type.
sign-in: To be used for a passwordless sign in, or sign up if the user does not exist.
email-verification: To be used to confirm email ownership.
forget-password: To be used to reset the password of a user.
What happens when this action runs
- WeWeb generates a one‑time code according to the selected
OTP Type. - In the
Data & APItab, the event triggerOn OTP requestedis fired with the data:
json
{
"email": "user@example.com", //email of the user the code was requested for
"otp": "362941", //code to send to the user
"type": "email-verification" //type of code requested
}- In the trigger, you decide how to send the code (for example, email with Resend, SMS with Twilio).
Learn how to use the 'On OTP requested' Event Trigger →
Verifying and using the code
After sending the code, allow the user to input it (for example, with the OTP Input Element) and run one of the OTP verification actions below. Choose the action that matches your configured OTP Type:
| Goal | Designated action | Notes |
|---|---|---|
Passwordless sign‑in (sign-in) | OTP – Sign in | Verifies the code and signs the user in. Alternatively, you can first Check code validity, then call a sign‑in flow. |
Email verification (email-verification) | OTP – Verify email | Marks the user’s email as verified after a successful check. |
Password reset (forget-password) | OTP – Reset password | Verifies the code and updates the password in one step. |
| Generic check (any type) | OTP – Check code validity | Use when you need to validate the code first, then branch your workflow manually. |
Example flow patterns
Passwordless sign‑in (OTP Type: sign‑in)
1
Run
OTP – Request code with OTP Type: sign-in2
In the
On OTP requested trigger, send the code (such as via email with Resend/SendGrid, or SMS with Twilio)3
After sending the code, allow the user to enter the code and run the
OTP – Check code validity actionEmail verification (OTP Type: email-verification)
1
Run
OTP – Request code with OTP Type: email-verification2
In the
On OTP requested trigger, send the verification code (such as via email with Resend/SendGrid, or SMS with Twilio)3
After sending the code, allow the user to enter the code and run the
OTP – Verify email actionPassword reset (OTP Type: forget-password)
1
Run
OTP – Request code with OTP Type: forget-password2
In the
On OTP requested trigger, send the reset code (such as via email with Resend/SendGrid, or SMS with Twilio)3
After sending the code, allow the user to enter the code and a new password, then run the
OTP – Reset password actionOTP INPUT ELEMENT
If you do not wish to create your own element to allow the user to input the code, WeWeb has its own native element.
Related Event Triggers
The
OTP – Request code action will fire these Event TriggersUse this trigger to deliver the one‑time code via email or SMS.

