Плагин ZeptoMail для Medusa
A Zoho ZeptoMail notification provider plugin for Medusa v2.
This plugin allows your Medusa application to send transactional emails via ZeptoMail using template-based dispatch (). It provides an in-code template store/mapping mechanism to decouple Medusa application events from ZeptoMail template IDs.
Install the plugin and its dependencies into your Medusa application:
Add the following environment variables to your Medusa project's file:
Register the provider in your Medusa application's :
The option allows you to map Medusa internal notification templates to ZeptoMail templates.
You can configure values as:
You can also import common Medusa notification template event names from :
When sending notifications via Medusa's notification service or workflow step:
MIT
npm install @take3labs/zeptomail1# ZeptoMail API endpoint (optional, defaults to https://api.zeptomail.com/)2# For EU: https://api.zeptomail.eu/3# For IN: https://api.zeptomail.in/4ZEPTOMAIL_URL=https://api.zeptomail.com/5
6# Your ZeptoMail Send Mail Token (from Agent -> SMTP/API)7# You can include or omit the "Zoho-enczapikey" prefix; the plugin normalizes it automatically.8ZEPTOMAIL_TOKEN=Zoho-enczapikey phr09...9
10# The verified sender email address in your ZeptoMail agent11ZEPTOMAIL_FROM_ADDRESS=noreply@yourdomain.com12
13# Optional sender display name14ZEPTOMAIL_FROM_NAME="My Store"1import { defineConfig, Modules } from "@medusajs/framework/utils"2
3export default defineConfig({4 // ...5 modules: [6 {7 resolve: "@medusajs/medusa/notification",8 options: {9 providers: [10 {11 resolve: "@take3labs/zeptomail/providers/zeptomail",12 id: "zeptomail",13 options: {14 channels: ["email"],15 url: process.env.ZEPTOMAIL_URL,16 token: process.env.ZEPTOMAIL_TOKEN,17 from_address: process.env.ZEPTOMAIL_FROM_ADDRESS,18 from_name: process.env.ZEPTOMAIL_FROM_NAME,19 templateMap: {20 "admin-password-reset": "2d6f.ca206d0a61dd719.k1.0a844e61-8e56-11f0-8679-5254001dc20d.199341ee643",21 "customer-password-reset": "your_customer_pwd_reset_alias",22 "order-placed": "order_confirmation_template_alias",23 "invite-created": "2d6f.ca206d0a61dd719.k1.invite_template_id",24 },25 },26 },27 ],28 },29 },30 ],31})"admin-password-reset": "2d6f.ca206d0a61dd719.k1.0a844e61-8e56-11f0-8679-5254001dc20d.199341ee643""order-placed": "order_placed_alias"1"customer-welcome": {2 template_alias: "welcome_email",3},4"invoice-receipt": {5 template_key: "2d6f.ca206d0a61dd719.k1.receipt_key",6}1import { MedusaNotificationTemplates } from "@take3labs/zeptomail"2
3// MedusaNotificationTemplates.ADMIN_PASSWORD_RESET -> "admin-password-reset"4// MedusaNotificationTemplates.CUSTOMER_PASSWORD_RESET -> "customer-password-reset"5// MedusaNotificationTemplates.ORDER_PLACED -> "order-placed"6// MedusaNotificationTemplates.ORDER_CANCELED -> "order-canceled"7// MedusaNotificationTemplates.ORDER_SHIPPED -> "order-shipped"8// MedusaNotificationTemplates.INVITE_CREATED -> "invite-created"1import { useNotificationService } from "@medusajs/medusa"2
3await notificationModuleService.createNotifications({4 to: "customer@example.com",5 channel: "email",6 template: "admin-password-reset", // matches the key in your templateMap7 data: {8 user_name: "John Doe",9 reset_url: "https://admin.yourstore.com/reset-password?token=xyz",10 },11})