{"_id":"@codemind.ec/medusa-plugin-listmonk","_rev":"3-2897aa88e37f754d176964100aae9cfc","name":"@codemind.ec/medusa-plugin-listmonk","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@codemind.ec/medusa-plugin-listmonk","version":"1.0.0","keywords":["medusa","medusa-plugin","medusa-v2","plugin","listmonk","notification","email","codemind","kollor"],"author":{"url":"https://codemind.ec","name":"Kollor","email":"dev@codemind.ec"},"license":"MIT","_id":"@codemind.ec/medusa-plugin-listmonk@1.0.0","maintainers":[{"name":"kollor","email":"isai.tobar@hotmail.com"}],"dist":{"shasum":"72b41076668663cde4b5d0c91c65b94cf58d4912","tarball":"https://registry.npmjs.org/@codemind.ec/medusa-plugin-listmonk/-/medusa-plugin-listmonk-1.0.0.tgz","fileCount":6,"integrity":"sha512-eTE0DUaR9Q8hmJhaQzRwU8VDBkJTXqaMLIgNzZ+qPJcF3bYF6osknQ9ssSd4Gz+TRH2KGjJBQ3JhxTwQJ5Cprg==","signatures":[{"sig":"MEUCIHRva7SKejEasQyyvvmu6GuwB8VxpAL1HWL0pUp4Cuj7AiEAy+tibjgL2Uyg0ZVtQIFgiIZtTiC6GAeYDxnx7VW6x5E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20028},"main":"./.medusa/server/src/index.js","engines":{"node":">=20"},"exports":{".":{"import":"./.medusa/server/src/index.js","default":"./.medusa/server/src/index.js","require":"./.medusa/server/src/index.js"},"./*":"./.medusa/server/src/*.js","./admin":{"import":"./.medusa/server/src/admin/index.mjs","default":"./.medusa/server/src/admin/index.js","require":"./.medusa/server/src/admin/index.js"},"./modules/*":"./.medusa/server/src/modules/*/index.js","./providers/*":"./.medusa/server/src/providers/*/index.js","./package.json":"./package.json","./.medusa/server/src/modules/*":"./.medusa/server/src/modules/*/index.js"},"gitHead":"e8f515a4d4fbf47a3ebf48140c0ef2f5ea88c670","scripts":{"dev":"medusa plugin:develop","build":"medusa plugin:build","prepublishOnly":"medusa plugin:build"},"_npmUser":{"name":"kollor","email":"isai.tobar@hotmail.com"},"_npmVersion":"10.9.2","description":"Medusa v2 notification provider for Listmonk — transactional emails with template mapping for orders, payments, and receipts.","directories":{},"_nodeVersion":"22.15.1","_hasShrinkwrap":false,"packageManager":"pnpm@9.15.9","devDependencies":{"vite":"^5.4.14","yalc":"^1.0.0-pre.53","react":"^18.3.1","ts-node":"^10.9.2","@swc/core":"^1.7.28","react-dom":"^18.3.1","prop-types":"^15.8.1","typescript":"^5","@types/node":"^20","@medusajs/ui":"^4.1.3","@types/react":"^18.3.3","@medusajs/cli":"2.13.3","@medusajs/icons":"^2.13.3","@medusajs/medusa":"2.13.3","@types/react-dom":"^18.3.0","@medusajs/admin-sdk":"2.13.3","@medusajs/framework":"2.13.3","@medusajs/test-utils":"2.13.3","@medusajs/admin-shared":"2.13.3"},"peerDependencies":{"@medusajs/ui":"^4.1.3","@medusajs/cli":"2.13.3","@medusajs/icons":"^2.13.3","@medusajs/medusa":"2.13.3","@medusajs/admin-sdk":"2.13.3","@medusajs/framework":"2.13.3","@medusajs/test-utils":"2.13.3","@medusajs/admin-shared":"2.13.3"},"_npmOperationalInternal":{"tmp":"tmp/medusa-plugin-listmonk_1.0.0_1774052866091_0.418406376995764","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@codemind.ec/medusa-plugin-listmonk","version":"1.0.1","keywords":["medusa","medusa-plugin","medusa-v2","plugin","listmonk","notification","email","codemind","kollor"],"author":{"url":"https://codemind.ec","name":"Kollor","email":"dev@codemind.ec"},"license":"MIT","_id":"@codemind.ec/medusa-plugin-listmonk@1.0.1","maintainers":[{"name":"kollor","email":"isai.tobar@hotmail.com"}],"dist":{"shasum":"d0149b14b01b3d3f9305800f354936c70167401c","tarball":"https://registry.npmjs.org/@codemind.ec/medusa-plugin-listmonk/-/medusa-plugin-listmonk-1.0.1.tgz","fileCount":7,"integrity":"sha512-zlEyhR2sjcFPidjjgp9saS6K6iQz41/f0sIXizoQSGSt103zh6q0ysmA2P3wb+TAERj588tBYf+xjTGOODANew==","signatures":[{"sig":"MEQCIGRzDuWZZetvovj6TFqZHtv5/k/TrDCkrFfr5MKovYcCAiBTxoFMrz7Z5mNvjwgMa+dbr1S51sCwKbxpN9iv4F6/0g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24696},"main":"./.medusa/server/src/index.js","_from":"file:codemind.ec-medusa-plugin-listmonk-1.0.1.tgz","engines":{"node":">=20"},"exports":{".":{"import":"./.medusa/server/src/index.js","default":"./.medusa/server/src/index.js","require":"./.medusa/server/src/index.js"},"./admin":{"import":"./.medusa/server/src/admin/index.mjs","default":"./.medusa/server/src/admin/index.js","require":"./.medusa/server/src/admin/index.js"},"./services/*":"./.medusa/server/src/services/*.js","./package.json":"./package.json"},"scripts":{"dev":"medusa plugin:develop","build":"medusa plugin:build"},"_npmUser":{"name":"kollor","email":"isai.tobar@hotmail.com"},"_resolved":"C:\\Users\\isai_\\AppData\\Local\\Temp\\29ad0d61382e9bb3661e940b6baac004\\codemind.ec-medusa-plugin-listmonk-1.0.1.tgz","_integrity":"sha512-zlEyhR2sjcFPidjjgp9saS6K6iQz41/f0sIXizoQSGSt103zh6q0ysmA2P3wb+TAERj588tBYf+xjTGOODANew==","_npmVersion":"10.9.2","description":"Medusa v2 notification provider for Listmonk — transactional emails with template mapping for orders, payments, and receipts.","directories":{},"_nodeVersion":"22.15.1","_hasShrinkwrap":false,"devDependencies":{"vite":"^5.4.14","yalc":"^1.0.0-pre.53","react":"^18.3.1","ts-node":"^10.9.2","@swc/core":"^1.7.28","react-dom":"^18.3.1","prop-types":"^15.8.1","typescript":"^5","@types/node":"^20","@medusajs/ui":"^4.1.3","@types/react":"^18.3.3","@medusajs/cli":"2.13.3","@medusajs/icons":"^2.13.3","@medusajs/medusa":"2.13.3","@types/react-dom":"^18.3.0","@medusajs/admin-sdk":"2.13.3","@medusajs/framework":"2.13.3","@medusajs/test-utils":"2.13.3","@medusajs/admin-shared":"2.13.3"},"peerDependencies":{"@medusajs/ui":"^4.1.3","@medusajs/cli":"2.13.3","@medusajs/icons":"^2.13.3","@medusajs/medusa":"2.13.3","@medusajs/admin-sdk":"2.13.3","@medusajs/framework":"2.13.3","@medusajs/test-utils":"2.13.3","@medusajs/admin-shared":"2.13.3"},"_npmOperationalInternal":{"tmp":"tmp/medusa-plugin-listmonk_1.0.1_1774066571087_0.3627515122169904","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@codemind.ec/medusa-plugin-listmonk","description":"Medusa v2 notification provider for Listmonk — transactional emails with template mapping for orders, payments, and receipts.","version":"1.0.2","author":{"name":"Kollor","email":"dev@codemind.ec","url":"https://codemind.ec"},"license":"MIT","main":"./.medusa/server/src/index.js","exports":{"./package.json":"./package.json",".":{"import":"./.medusa/server/src/index.js","require":"./.medusa/server/src/index.js","default":"./.medusa/server/src/index.js"},"./services/*":"./.medusa/server/src/services/*.js","./admin":{"import":"./.medusa/server/src/admin/index.mjs","require":"./.medusa/server/src/admin/index.js","default":"./.medusa/server/src/admin/index.js"}},"scripts":{"build":"medusa plugin:build","dev":"medusa plugin:develop","prepublishOnly":"medusa plugin:build"},"devDependencies":{"@medusajs/admin-sdk":"2.13.3","@medusajs/admin-shared":"2.13.3","@medusajs/cli":"2.13.3","@medusajs/framework":"2.13.3","@medusajs/icons":"^2.13.3","@medusajs/medusa":"2.13.3","@medusajs/test-utils":"2.13.3","@medusajs/ui":"^4.1.3","@swc/core":"^1.7.28","@types/node":"^20","@types/react":"^18.3.3","@types/react-dom":"^18.3.0","prop-types":"^15.8.1","react":"^18.3.1","react-dom":"^18.3.1","ts-node":"^10.9.2","typescript":"^5","vite":"^5.4.14","yalc":"^1.0.0-pre.53"},"engines":{"node":">=20"},"keywords":["medusa","medusa-plugin","medusa-v2","plugin","listmonk","notification","email","codemind","kollor"],"packageManager":"pnpm@9.15.9","peerDependencies":{"@medusajs/admin-sdk":"2.13.3","@medusajs/admin-shared":"2.13.3","@medusajs/cli":"2.13.3","@medusajs/framework":"2.13.3","@medusajs/icons":"^2.13.3","@medusajs/medusa":"2.13.3","@medusajs/test-utils":"2.13.3","@medusajs/ui":"^4.1.3"},"_id":"@codemind.ec/medusa-plugin-listmonk@1.0.2","gitHead":"4f7974c7a642ed7ecc3c4ff9105b6366ea70b238","_nodeVersion":"22.15.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-FhYZH9Kau/4TXD+vGYlDybA4jYG28FdR/mcbthCjl+QyxoKMovm2dPM6hOjcH8B4gfc0DuH+raT9uVsPFgo7xQ==","shasum":"50ef1380219ab38106f60c6fe7c20f2e8972d3a5","tarball":"https://registry.npmjs.org/@codemind.ec/medusa-plugin-listmonk/-/medusa-plugin-listmonk-1.0.2.tgz","fileCount":7,"unpackedSize":26957,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIF7R9Zy47EGs8v9MfqJWXmB07KRTZT9NKqz7FCdDjnphAiEA+zBCE5Htk7n1gxHoTRi88X5ylS4ysGEkYEo3+o+oAd4="}]},"_npmUser":{"name":"kollor","email":"isai.tobar@hotmail.com"},"directories":{},"maintainers":[{"name":"kollor","email":"isai.tobar@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/medusa-plugin-listmonk_1.0.2_1774073512058_0.18986818480656975"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-21T00:27:45.955Z","modified":"2026-03-21T06:11:52.316Z","1.0.0":"2026-03-21T00:27:46.229Z","1.0.1":"2026-03-21T04:16:11.248Z","1.0.2":"2026-03-21T06:11:52.203Z"},"author":{"name":"Kollor","email":"dev@codemind.ec","url":"https://codemind.ec"},"license":"MIT","keywords":["medusa","medusa-plugin","medusa-v2","plugin","listmonk","notification","email","codemind","kollor"],"description":"Medusa v2 notification provider for Listmonk — transactional emails with template mapping for orders, payments, and receipts.","maintainers":[{"name":"kollor","email":"isai.tobar@hotmail.com"}],"readme":"# @codemind.ec/medusa-plugin-listmonk\r\n\r\nMedusa v2 notification provider for **Listmonk** — transactional emails with template mapping, automatic subscriber management, and attachment support.\r\n\r\n[![npm version](https://img.shields.io/npm/v/@codemind.ec/medusa-plugin-listmonk.svg)](https://www.npmjs.com/package/@codemind.ec/medusa-plugin-listmonk)\r\n[![Medusa v2](https://img.shields.io/badge/medusa-v2-blueviolet)](https://docs.medusajs.com)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\n---\r\n\r\n## Features\r\n\r\n- **Transactional emails** — sends emails via Listmonk's `/api/tx` endpoint.\r\n- **Template mapping** — map semantic template names (e.g., `\"order-placed\"`) to Listmonk template IDs.\r\n- **Auto subscriber management** — automatically creates Listmonk subscribers on first email send.\r\n- **Basic Auth** — secure authentication with Listmonk API.\r\n- **Attachments** — supports file attachments (Buffer or base64).\r\n- **Configurable** — full control over sender, list assignment, and template resolution.\r\n\r\n---\r\n\r\n## Prerequisites\r\n\r\n| Requirement | Version |\r\n|-------------|---------|\r\n| Node.js     | >= 20   |\r\n| Medusa      | >= 2.4.0 |\r\n| Listmonk    | any     |\r\n\r\n---\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @codemind.ec/medusa-plugin-listmonk\r\n# or\r\npnpm add @codemind.ec/medusa-plugin-listmonk\r\n```\r\n\r\n---\r\n\r\n## Configuration\r\n\r\nThis is a **notification provider**, not a standalone plugin. Register it under the notification module in your `medusa-config.ts`:\r\n\r\n```typescript\r\nimport { defineConfig } from \"@medusajs/framework/utils\"\r\n\r\nexport default defineConfig({\r\n  // ...\r\n  modules: [\r\n    {\r\n      resolve: \"@medusajs/medusa/notification\",\r\n      options: {\r\n        providers: [\r\n          {\r\n            resolve: \"@codemind.ec/medusa-plugin-listmonk\",\r\n            id: \"listmonk\",\r\n            options: {\r\n              channels: [\"email\"],\r\n              url: process.env.LISTMONK_URL,\r\n              username: process.env.LISTMONK_USERNAME,\r\n              password: process.env.LISTMONK_PASSWORD,\r\n              from_email: process.env.LISTMONK_FROM_EMAIL,\r\n              list_id: process.env.LISTMONK_LIST_ID,\r\n              template_map: {\r\n                \"order-placed\": process.env.LISTMONK_TEMPLATE_ID_ORDER_PLACED || \"order-placed\",\r\n                \"order-placed-admin\": process.env.LISTMONK_TEMPLATE_ID_ORDER_PLACED_ADMIN || \"order-placed-admin\",\r\n                \"order-updated\": process.env.LISTMONK_TEMPLATE_ID_ORDER_UPDATED || \"order-updated\",\r\n                \"payment-captured\": process.env.LISTMONK_TEMPLATE_ID_PAYMENT_CAPTURED || \"payment-captured\",\r\n                \"payment-captured-admin\": process.env.LISTMONK_TEMPLATE_ID_PAYMENT_CAPTURED_ADMIN || \"payment-captured-admin\",\r\n                \"receipt-uploaded\": process.env.LISTMONK_TEMPLATE_ID_RECEIPT_UPLOADED || \"receipt-uploaded\",\r\n              },\r\n            },\r\n          },\r\n        ],\r\n      },\r\n    },\r\n  ],\r\n})\r\n```\r\n\r\n> **Nota:** Este paquete NO se agrega a `plugins[]`. Se registra como proveedor de notificaciones dentro del módulo `@medusajs/medusa/notification`.\r\n> Los valores de `template_map` pueden ser IDs numéricos de Listmonk (e.g. `10`) o nombres semánticos que Listmonk resuelve por nombre de template.\r\n\r\n### Environment Variables\r\n\r\n| Variable | Required | Description |\r\n|----------|----------|-------------|\r\n| `LISTMONK_URL` | Yes | Listmonk instance URL (e.g., `https://listmonk.example.com`) |\r\n| `LISTMONK_USERNAME` | No | Basic Auth username |\r\n| `LISTMONK_PASSWORD` | No | Basic Auth password |\r\n| `LISTMONK_FROM_EMAIL` | No | Default sender email |\r\n| `LISTMONK_LIST_ID` | No | Default list ID for new subscribers |\r\n| `LISTMONK_LIST_UUID` | No | List UUID (for other Listmonk endpoints if needed) |\r\n| `LISTMONK_TEMPLATE_ID_ORDER_PLACED` | No | Template for order placed (customer) |\r\n| `LISTMONK_TEMPLATE_ID_ORDER_PLACED_ADMIN` | No | Template for order placed (admin) |\r\n| `LISTMONK_TEMPLATE_ID_ORDER_UPDATED` | No | Template for order updated |\r\n| `LISTMONK_TEMPLATE_ID_PAYMENT_CAPTURED` | No | Template for payment captured (customer) |\r\n| `LISTMONK_TEMPLATE_ID_PAYMENT_CAPTURED_ADMIN` | No | Template for payment captured (admin) |\r\n| `LISTMONK_TEMPLATE_ID_RECEIPT_UPLOADED` | No | Template for receipt uploaded |\r\n\r\n### Options Reference\r\n\r\n| Option | Type | Description |\r\n|--------|------|-------------|\r\n| `url` | string | **Required.** Listmonk instance URL |\r\n| `username` | string? | Basic Auth username |\r\n| `password` | string? | Basic Auth password |\r\n| `from_email` | string? | Default sender email |\r\n| `list_id` | string? | Listmonk list ID for subscriber assignment |\r\n| `list_uuid` | string? | Listmonk list UUID |\r\n| `template_map` | `Record<string, string \\| number>`? | Map of semantic names → Listmonk template IDs |\r\n\r\n---\r\n\r\n## How It Works\r\n\r\n### Provider Identifier\r\n\r\n`notification-listmonk`\r\n\r\n### Send Flow\r\n\r\nWhen `notificationModuleService.createNotifications()` is called:\r\n\r\n1. **Validate** — `to` (recipient) and `template` (or `data.template_id`) are required.\r\n2. **Resolve template ID** — priority: `data.template_id` > `template_map[template]` > `template`.\r\n3. **Ensure subscriber** — calls Listmonk API to create/find subscriber by email. Extracts name from customer data or shipping address. Sets `attribs: { source: \"medusa\" }`.\r\n4. **Send email** — POST to `/api/tx` with:\r\n   ```json\r\n   {\r\n     \"subscriber_email\": \"customer@example.com\",\r\n     \"template_id\": 10,\r\n     \"data\": { \"order_id\": \"123\", \"total\": \"100.00\" },\r\n     \"content_type\": \"html\"\r\n   }\r\n   ```\r\n5. **Return** — `{ id: \"listmonk-tx-{timestamp}\" }`\r\n\r\n### Authentication\r\n\r\nIf `username` and `password` are configured, all requests include a Basic Auth header. Timeout: 15 seconds.\r\n\r\n---\r\n\r\n## Usage\r\n\r\n### In a Subscriber\r\n\r\n```typescript\r\nimport { SubscriberArgs, type SubscriberConfig } from \"@medusajs/framework\"\r\nimport { Modules } from \"@medusajs/framework/utils\"\r\n\r\nexport default async function orderPlacedHandler({\r\n  event,\r\n  container,\r\n}: SubscriberArgs<{ id: string }>) {\r\n  const notificationService = container.resolve(Modules.NOTIFICATION)\r\n\r\n  await notificationService.createNotifications({\r\n    to: \"customer@example.com\",\r\n    template: \"order-placed\",   // resolves via template_map → Listmonk ID\r\n    channel: \"email\",\r\n    data: {\r\n      order_id: event.data.id,\r\n      customer_name: \"John Doe\",\r\n      total: \"$150.00\",\r\n    },\r\n  })\r\n}\r\n\r\nexport const config: SubscriberConfig = {\r\n  event: \"order.placed\",\r\n}\r\n```\r\n\r\n### With Explicit Template ID\r\n\r\n```typescript\r\nawait notificationService.createNotifications({\r\n  to: \"customer@example.com\",\r\n  template: \"15\",  // direct Listmonk template ID\r\n  channel: \"email\",\r\n  data: {\r\n    order_id: \"ord_123\",\r\n  },\r\n})\r\n```\r\n\r\n### With Attachments\r\n\r\n```typescript\r\nawait notificationService.createNotifications({\r\n  to: \"customer@example.com\",\r\n  template: \"invoice\",\r\n  channel: \"email\",\r\n  data: { order_id: \"ord_123\" },\r\n  attachments: [\r\n    {\r\n      filename: \"invoice.pdf\",\r\n      content: pdfBuffer,          // Buffer or base64 string\r\n      content_type: \"application/pdf\",\r\n    },\r\n  ],\r\n})\r\n```\r\n\r\n---\r\n\r\n## Error Handling\r\n\r\n- Invalid template IDs are logged but don't throw.\r\n- Subscriber creation errors are ignored (subscriber may already exist).\r\n- Network errors are propagated to the caller.\r\n\r\n---\r\n\r\n## License\r\n\r\nMIT — [CodeMind](https://codemind.ec)\r\n","readmeFilename":"README.md"}