This page describes plugin configuration only.
Register the plugin in medusa-config.ts:
module.exports = defineConfig({
plugins: [
{
resolve: "@codee-sh/medusa-plugin-notification-emails",
options: {
customTranslations: {},
extend: {
services: [],
},
},
},
],
})Overrides for translation dictionaries.
Type:
Record<string, Record<string, Record<string, any>>>
Guidelines:
- use template id as first key (for example
system_order-placed) - use locale (
pl,en, ...) as second key - provide translation object as value
Example:
module.exports = defineConfig({
plugins: [
{
resolve: "@codee-sh/medusa-plugin-notification-emails",
options: {
customTranslations: {
"system_order-placed": {
pl: {
headerTitle: "#{{data.order.transformed.order_number}} - Zamowienie",
labels: {
orderNumber: "Numer zamowienia",
},
},
},
},
},
},
],
})More details: Translations Documentation
In many projects, a backend/admin base URL is stored in plugin options:
backend_url: process.env.POS_BACKEND_URLUse this value when your templates build links (especially Slack buttons/URLs), for example via {{data.backend_url}} or {{data.backendUrl}} in template blocks.
Recommended pattern:
- keep URL in config (
backend_url) - pass it to template render input data/options in your project flow
- use consistent variable naming in template blocks
Register external templates for services (email, slack).
Type:
{
extend?: {
services?: Array<{
id: string
templates?: Array<{
name: string
path: string
}>
}>
}
}Example:
import path from "path"
module.exports = defineConfig({
plugins: [
{
resolve: "@codee-sh/medusa-plugin-notification-emails",
options: {
extend: {
services: [
{
id: "slack",
templates: [
{
name: "external_inventory-alert",
path: path.resolve(
require.resolve("@your-package/templates/slack/inventory-alert")
),
},
],
},
],
},
},
},
],
})Notes:
- templates are loaded during module initialization
- if service id is unknown, template registration is skipped
- registered templates are available as type
external
Template ID resolution:
- IDs starting with
systemorexternalare rendered from the registry and are not looked up in the database. - Any other ID is treated as a DB template and must exist in
mpn_builder_template.
import path from "path"
module.exports = defineConfig({
plugins: [
{
resolve: "@codee-sh/medusa-plugin-notification-emails",
options: {
backend_url: process.env.POS_BACKEND_URL,
customTranslations: {
"system_order-placed": {
en: {
labels: {
orderNumber: "Order number",
},
},
},
},
extend: {
services: [
{
id: "email",
templates: [
{
name: "external_order-summary",
path: path.resolve(
require.resolve("@your-scope/templates/email/order-summary")
),
},
],
},
],
},
},
},
],
})This plugin renders notification content. Delivery is still handled by configured Medusa notification providers.
Provider setup is configured in Medusa modules.
- make sure template key in
customTranslationsmatches template id used at render time - verify locale key (
pl,en, ...) - verify translation keys used in templates exist
- verify
extend.services[].idmatches a registered service (emailorslack) - verify
pathresolves correctly and module can be imported - check startup logs for warning messages during template registration
- verify Medusa notification provider is configured and working
- verify your notification flow/subscriber is triggered for expected event