Workflows
Feedback & Reviews
Grow your business faster by asking users to leave a positive review
Intro
Feedback and reviews are the lifeblood of any business. Setting up an automated workflow to do so however, is unnecessarily complicated by the need to implement notification logic like delayed send.
Explore the source code on GitHub
Preview
Code Example
import { workflow } from '@novu/framework';
import { renderFeedbackEmail } from '../emails/feedback';
import { zodControlSchema, zodDelayControlSchema, zodPayloadSchema } from './schemas';
export const AirbnbReview = workflow(
"Airbnb Review",
async ({ step, payload }) => {
/**
* Delay Step
*/
await step.delay(
'delay-1-week',
async (controls) => {
return {
type: "regular",
unit: controls.unit, // 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months'
amount: controls.amount, // the number of units to delay workflow execution for
};
},
{
controlSchema: zodDelayControlSchema
}
);
/**
* Email Step
*/
await step.email(
"send-email",
async (controls) => {
return {
subject: controls.emailSubject,
body: renderFeedbackEmail(controls, payload),
};
},
{
controlSchema: zodControlSchema
}
);
},
{
payloadSchema: zodPayloadSchema
},
);
Was this page helpful?