OTP (One-Time Password)
API Reference
Subscribers
- GETGet subscribers
- POSTCreate subscriber
- POSTBulk create subscribers
- GETGet subscriber
- PUTUpdate subscriber
- DELDelete subscriber
- PUTUpdate subscriber credentials
- DELDelete subscriber credentials by providerId
- PATCHUpdate subscriber online status
- GETGet subscriber preferences
- GETGet subscriber global preferences
- PATCHUpdate subscriber preference
- PATCHUpdate subscriber global preferences
- GETGet in-app notification feed for a particular subscriber
- GETGet the unseen in-app notifications count for subscribers feed
- POSTMark a subscriber feed message as seen
- POSTMarks all the subscriber messages as read, unread, seen or unseen. Optionally you can pass feed id (or array) to mark messages of a particular feed.
- POSTMark message action as seen
- GETHandle providers oauth redirect
- GETHandle chat oauth
Topics
Notification
Workflows
Workflow Overrides
Workflow groups
Integrations
Layouts
Execution Details
Organizations
OTP (One-Time Password)
Send OTPs without setting up your own infrastructure
Intro
Sending One-Time Passwords (OTP) is often unnecessarily complicated, requiring engineering teams to waste valuable development cycles setting up SMS infrastructure and getting email reputation satisfactory for sending six digit passcodes. This three channel workflow example shows how to send an email, push notification, or SMS OTP.
Explore the source code on GitHub
Preview
Send an email
Send a mobile push notification
Send an SMS notification
Code Sample
import { workflow } from '@novu/framework';
import { renderOtpEmail } from '../emails/slack-otp';
import { zodControlSchema, zodPayloadSchema, zodPushControlSchema, zodSmsControlSchema } from './schemas';
export const SlackVerificationOTP = workflow(
"Slack Verify OTP",
async ({ step, payload }) => {
await step.email(
"send-email",
async (controls) => {
return {
subject: controls.emailSubject,
body: renderOtpEmail(controls, payload),
};
},
{
controlSchema: zodControlSchema
});
// -----------------------------------push flow-------------------------------------------------------------------------
await step.push('send-push', async (controls) => {
return {
subject: controls.pushNotificationSubject,
body: `Your verification code from Slack is ${payload.validationCode}`,
};
},
{
controlSchema: zodPushControlSchema
});
// -----------------------------------sms flow-------------------------------------------------------------------------
await step.sms('send-sms', async (controls) => {
return {
subject: controls.smsSubject,
body: `Your verification code from Slack is ${payload.validationCode}`,
};
},
{
controlSchema: zodSmsControlSchema
});
},
{
payloadSchema: zodPayloadSchema
},
);
Was this page helpful?
On this page