Medusa v2 plugin for building and sending transactional notifications from one place. It provides a template system, admin builder, and rendering workflows for email and Slack.
- Build and manage notification templates for two channels: email and Slack
- Use three template sources: built-in (
system), database-managed (db), and code-registered (external) - Build templates quickly with a reusable block system instead of writing full markup from scratch
- Edit
dbtemplates in Medusa Admin using a block-based builder - Render notifications through dedicated workflows and pass output to Medusa notification providers
- Customize translations and register external templates without changing core plugin code
- Medusa:
>= 2.8.8 - Node.js:
>= 20
npm install @codee-sh/medusa-plugin-notification-emails
# or
yarn add @codee-sh/medusa-plugin-notification-emailsreact and react-dom are peer dependencies: the email renderer needs them at runtime. Keep them in
your application's dependencies, not devDependencies - Medusa Cloud does not install development
dependencies. The plugin pins @react-email/components 0.3.3 and @react-email/render 1.1.4, the
versions Medusa Cloud supports.
Register plugin in medusa-config.ts:
module.exports = defineConfig({
plugins: [
{
resolve: "@codee-sh/medusa-plugin-notification-emails",
options: {
// The plugin's order emails are opt-in, see docs/configuration.md
subscribers: {},
customTranslations: {},
extend: {
services: [],
},
},
},
],
})Then continue with configuration and usage guides in docs/.
The plugin sends nothing on its own unless you enable its subscribers. To render an email in your
own code, run emailServiceWorkflow and pass the result to the Notification Module:
import { emailServiceWorkflow } from "@codee-sh/medusa-plugin-notification-emails/workflows"
const {
result: { subject, html, text },
} = await emailServiceWorkflow(container).run({
input: { template_id: "external_order-summary", data, options: { locale: "en" } },
})-
Order emails are opt-in. The
order.placedandorder.completedsubscribers no longer email customers by default. Addsubscribersto keep order emails:subscribers: { "order.placed": { enabled: true, locale: "pl" }, "order.completed": { enabled: true, locale: "pl" }, }
1.0.x sent them in
pl; the default locale is nowen. -
Data values are HTML-escaped in
text,rowandproduct-itemvalues. Put markup in translations, not in data. -
Missing data renders empty. A
{{data.*}}placeholder with no value renders as an empty string, and aheading,textorrowleft empty is not rendered. -
The Builder - Lexical admin page is removed.
Template IDs are resolved by prefix:
- IDs starting with
systemorexternalare rendered from the in-memory registry (no DB lookup). - Other IDs are treated as DB templates and must exist in
mpn_builder_template.
Public entrypoints:
@codee-sh/medusa-plugin-notification-emails/workflows-emailServiceWorkflow,slackServiceWorkflowand their input types (EmailServiceWorkflowInput,EmailServiceWorkflowOutput,SlackServiceWorkflowInput)@codee-sh/medusa-plugin-notification-emails/modules/*@codee-sh/medusa-plugin-notification-emails/providers/*@codee-sh/medusa-plugin-notification-emails/utils@codee-sh/medusa-plugin-notification-emails/admin
MIT
Codee Team - https://codee.dev