Skip to content

Updating visuals

If you see any images containing outdated UI, please bear with us.

We are updating all content as quickly as possible to mirror our new UI.

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 KeyExample InputDescription
Email"user@example.com"Recipient email address that will receive the code.
OTP Typesign-inControls 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

  1. WeWeb generates a one‑time code according to the selected OTP Type.
  2. In the Data & API tab, the event trigger On OTP requested is 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
}
  1. 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:

GoalDesignated actionNotes
Passwordless sign‑in (sign-in)OTP – Sign inVerifies 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 emailMarks the user’s email as verified after a successful check.
Password reset (forget-password)OTP – Reset passwordVerifies the code and updates the password in one step.
Generic check (any type)OTP – Check code validityUse 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-in
2
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 action

Email verification (OTP Type: email-verification)


1
Run OTP – Request code with OTP Type: email-verification
2
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 action

Password reset (OTP Type: forget-password)


1
Run OTP – Request code with OTP Type: forget-password
2
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 action

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

OTP Input Element ->

The OTP – Request code action will fire these Event Triggers

Use this trigger to deliver the one‑time code via email or SMS.

Learn more about Event Triggers →