Skip to content

user-notifications

@evolve-framework/user-notifications · v1.0.0

The messages Evolve sends when a customer should be told something: an account was created, an order was confirmed or shipped, a password reset was requested or completed, an associate was invited, a quote was requested or is ready. Each is a typed, validated message published to a queue for a mailer to send.

When to use

The commercetools engine raises these notifications itself, so a project mostly meets this package as the contract between its commerce service and the service that sends the emails. Use it directly in that mail service, to read a notification back with parseNotification, or in your own module to queue one.

Get started

  1. Install the package with the peer dependencies it needs. It comes from the Evolve registry, which needs a one-time sign-in.

    pnpm add @evolve-framework/user-notifications @evolve-framework/core zod
    Requirements3
    @evolve-framework/core>= 1.0.0 < 2.0.0
    @types/node>=22optional
    zod>= 4.4.0 < 5.0.0

For example:

import { parseNotification } from "@evolve-framework/user-notifications";
// In the service that sends the emails: validate, then switch on the type.
export const handleNotification = async (message: unknown): Promise<void> => {
const notification = parseNotification(message);
if (notification.type === "order-confirmed") {
// render and send the order confirmation
}
};

Entry points

@evolve-framework/user-notificationsThe notification types and schemas, parseNotification to read one back, and QueuedUserNotificationClient to publish one.15 exports