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.

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 event

Event data

Display KeyExample ValueDescription
email"user@example.com"The target user email to receive the OTP
otp"362941"The one‑time passcode generated by WeWeb
typeemail-verificationContext 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.

  1. Open Data & API → Workflows → Event triggers.
  2. Open On OTP requested.
  3. Add the backend Send Email action.
  4. Bind the recipient to email.
  5. Set a subject based on the type, such as Your verification code or Reset your password.
  6. In the message body, include the otp value from the event data.

What you need to bind

  • Recipient: email
  • Subject: A subject that matches the OTP type
  • Content: The otp value 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.

View full list of email sending integrations →