Appearance
On OTP requested
You can use this event to generate a one‑time code that can then be sent to the user to allow them to verify their email, sign in, or reset their password.
Interface actions that fire the
On OTP requested eventEvent data
| Display Key | Example Value | Description |
|---|---|---|
| "user@example.com" | The target user email to receive the OTP | |
| otp | "362941" | The one‑time passcode generated by WeWeb |
| type | email-verification | Context for the OTP request. This matches the OTP Type you selected in OTP - Request code: sign-in, email-verification, or forget-password. |
Example payload
json
{ "email": "user@example.com", "otp": "362941", "type": "email-verification" }Send the OTP via email
For most projects, this Event Trigger should use WeWeb's built-in backend Send Email action.
Recommended setup
- Open
Data & API → Workflows → Event triggers. - Open
On OTP requested. - Add the backend
Send Emailaction. - Bind the recipient to
email. - Set a subject based on the
type, such asYour verification codeorReset your password. - In the message body, include the
otpvalue from the event data.
What you need to bind
- Recipient:
email - Subject: A subject that matches the OTP
type - Content: The
otpvalue somewhere in the text or HTML
Example HTML snippet:
html
<p>Hi,</p>
<p>Your verification code is: <strong>{{otp}}</strong></p>
<p>This code will expire shortly. If you didn’t request it, you can ignore this email.</p>Alternative: use another provider or channel
If you need provider-specific features, you can use an email integration such as Resend, SendGrid, or Postmark. You can also use another channel entirely if your project needs it.

