Intro

What delights the dopamine receptors more than an email confirming their order’s delivery date? Reward your buyers by letting them know their order is confirmed and on the way, complete with tracking info fetched by leveraging the payload schema.

Explore the source code on GitHub

Preview

Code Example

import { workflow } from '@novu/framework';
import { renderShippingOrderEmail } from '../emails/shipping-order-confirmation';
import { zodControlSchema, zodPayloadSchema, jsonControlSchema, jsonPayloadSchema } from './schemas';

export const AmazonShippingOrderConfirmation = workflow(
    "Amazon Shipping Order",
    async ({ step, payload }) => {
      await step.email(
        "send-email",
        async (controls) => {
          return {
            subject: controls.emailSubject,
            body: renderShippingOrderEmail(controls, payload),
          };
        },
        {
          controlSchema: zodControlSchema
        }
      );
    },
    { 
      payloadSchema: zodPayloadSchema
    },
);

 PROTIP: Delight users by sending their tracking info - leverage the payload schema to do this.