ZeptoMail Notifications
Send emails via Zoho ZeptoMail
@take3labs/zeptomail
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 (Copy to clipboardsendMailWithTemplate). It provides an in-code template store/mapping mechanism to decouple Medusa application events from ZeptoMail template IDs.
Features
- ZeptoMail Template Sending: Dispatches transactional emails via ZeptoMail's Copy to clipboard
sendMailWithTemplateendpoint. - Decoupled Template Store: Map Medusa notification events (e.g. Copy to clipboard
admin-password-reset, Copy to clipboardorder-placed) directly to ZeptoMail Copy to clipboardtemplate_keyor Copy to clipboardtemplate_alias. - Flexible Credential Handling: Auto-normalizes authorization headers (Copy to clipboard
Zoho-enczapikeyprefix) and regional endpoints (US, EU, IN, etc.). - Attachment & Merge Info Support: Automatically formats Medusa notification data and attachments for ZeptoMail.
- Built for Medusa v2: Full support for Medusa v2 module providers and Copy to clipboard
medusa plugin:build.
Prerequisites
- A Zoho ZeptoMail account.
- A configured Mail Agent with a verified sending domain.
- A Send Mail Token generated in your Agent settings under SMTP / API.
- Email Templates created in your Mail Agent with their respective Template Key (e.g. Copy to clipboard
2d6f.ca206d0a...k1...) or Template Alias.
Installation
Install the plugin and its dependencies into your Medusa application:
1npm install @take3labs/zeptomail
Environment Variables
Add the following environment variables to your Medusa project's Copy to clipboard.env file:
1234567891011121314# ZeptoMail API endpoint (optional, defaults to https://api.zeptomail.com/)# For EU: https://api.zeptomail.eu/# For IN: https://api.zeptomail.in/ZEPTOMAIL_URL=https://api.zeptomail.com/# Your ZeptoMail Send Mail Token (from Agent -> SMTP/API)# You can include or omit the "Zoho-enczapikey" prefix; the plugin normalizes it automatically.ZEPTOMAIL_TOKEN=Zoho-enczapikey phr09...# The verified sender email address in your ZeptoMail agentZEPTOMAIL_FROM_ADDRESS=noreply@yourdomain.com# Optional sender display nameZEPTOMAIL_FROM_NAME="My Store"
Configuration
Register the provider in your Medusa application's Copy to clipboardmedusa-config.ts:
1234567891011121314151617181920import { defineConfig, Modules } from "@medusajs/framework/utils"export default defineConfig({// ...modules: [{resolve: "@medusajs/medusa/notification",options: {providers: [{resolve: "@take3labs/zeptomail/providers/zeptomail",id: "zeptomail",options: {channels: ["email"],url: process.env.ZEPTOMAIL_URL,token: process.env.ZEPTOMAIL_TOKEN,from_address: process.env.ZEPTOMAIL_FROM_ADDRESS,from_name: process.env.ZEPTOMAIL_FROM_NAME,templateMap: {"admin-password-reset": "2d6f.ca206d0a61dd719.k1.0a844e61-8e56-11f0-8679-5254001dc20d.199341ee643",
Template Store & Decoupling
The Copy to clipboardtemplateMap option allows you to map Medusa internal notification templates to ZeptoMail templates.
You can configure values as:
- A Template Key (ZeptoMail's unique identifier):
1"admin-password-reset": "2d6f.ca206d0a61dd719.k1.0a844e61-8e56-11f0-8679-5254001dc20d.199341ee643"
- A Template Alias (Custom human-readable alias configured in ZeptoMail):
1"order-placed": "order_placed_alias"
- An Explicit Object:
123456"customer-welcome": {template_alias: "welcome_email",},"invoice-receipt": {template_key: "2d6f.ca206d0a61dd719.k1.receipt_key",}
Predefined Constants
You can also import common Medusa notification template event names from Copy to clipboard@take3labs/zeptomail:
12345678import { MedusaNotificationTemplates } from "@take3labs/zeptomail"// MedusaNotificationTemplates.ADMIN_PASSWORD_RESET -> "admin-password-reset"// MedusaNotificationTemplates.CUSTOMER_PASSWORD_RESET -> "customer-password-reset"// MedusaNotificationTemplates.ORDER_PLACED -> "order-placed"// MedusaNotificationTemplates.ORDER_CANCELED -> "order-canceled"// MedusaNotificationTemplates.ORDER_SHIPPED -> "order-shipped"// MedusaNotificationTemplates.INVITE_CREATED -> "invite-created"
Triggering Notifications
When sending notifications via Medusa's notification service or workflow step:
1234567891011import { useNotificationService } from "@medusajs/medusa"await notificationModuleService.createNotifications({to: "customer@example.com",channel: "email",template: "admin-password-reset", // matches the key in your templateMapdata: {user_name: "John Doe",reset_url: "https://admin.yourstore.com/reset-password?token=xyz",},})
License
MIT

