Medusa Athos Integration Plugin.
Medusa v2 plugin that generates a streaming NDJSON product feed for Athos Commerce integration.
yarn add @weareseeed/medusa-athos-plugin
1// medusa-config.ts2import { defineConfig } from "@medusajs/framework/config"34export default defineConfig({5 plugins: [6 {7 resolve: "@weareseeed/medusa-athos-plugin",8 options: {},9 },10 ],11})
npx medusa db:migrate
Set the plugin configuration through the authenticated admin endpoint:
1curl -X POST http://localhost:9000/admin/athos/config \2 -H "Authorization: Bearer <admin_token>" \3 -H "Content-Type: application/json" \4 -d '{5 "storefront_url": "https://mystore.com",6 "feed_token": "a-secret-token",7 "region_id": "reg_01...",8 "sales_channel_ids": ["sc_01..."],9 "swatch_option_titles": ["color", "colour"]10 }'
| Field | Type | Required | Description |
|---|---|---|---|
| Yes | Base URL prepended to for each product URL | ||
| Yes | Secret token required to access the feed endpoint | ||
| No | When set, prices are filtered to the region's currency | ||
| No | When set, only products in these sales channels are included | ||
| No | Option titles treated as swatches (default: ) |
Returns an stream. Each product produces:
| Field | Description |
|---|---|
| Variant ID | |
| Variant SKU | |
| Variant title | |
| Lowest price for the variant (filtered by region if configured) | |
| Product thumbnail | |
| Product description | |
| Array of category path strings (e.g. ) | |
| Array of category IDs | |
| Comma-separated product tags | |
| Parent product ID | |
| Parent product title | |
| Parent product thumbnail | |
| 1-based position within the product | |
| if the variant is available | |
| % of variants in stock across the product | |
| All product options with positions and values | |
| This variant's chosen option values | |
| Values of configured swatch options (product-level) |
Same as variant line minus all private fields, with set to the product ID and set to the lowest price across all variants.
1{"Product ID":"variant_01...","SKU":"1","Name":"blue, m","Product URL":"https://mystore.com/products/example","Price":10,"Thumbnail URL":"https://...","Description":"...","Category":["Tops"],"Category ID":["pcat_01..."],"__parent_id":"prod_01...","__parent_title":"Example Product","__parent_image":"https://...","__variant_position":1,"__in_stock":true,"__in_stock_pct":100,"__standard_options":{"color":{"position":0,"values":["red","blue"]},"size":{"position":1,"values":["s","m"]}},"__selected_options":{"color":{"value":"blue"},"size":{"value":"m"}},"__swatch_options":{"red":{"value":"red"},"blue":{"value":"blue"}}}2{"Product ID":"prod_01...","Name":"Example Product","Product URL":"https://mystore.com/products/example","Price":10,"Thumbnail URL":"https://...","Description":"...","Category":["Tops"],"Category ID":["pcat_01..."]}
Pass options when registering the plugin in to extend the feed.
1import { defineConfig } from "@medusajs/framework/config"2import type { FeedLineContext } from "@weareseeed/medusa-athos-plugin/types"34export default defineConfig({5 plugins: [6 {7 resolve: "@weareseeed/medusa-athos-plugin",8 options: {9 feed: {10 extraProductFields: ["metadata", "variants.metadata"],11 transformLine: (line, ctx: FeedLineContext) => {12 line["Brand"] = (ctx.product as any).metadata?.brand ?? undefined1314 if (ctx.type === "variant") {15 line["Custom Variant Field"] = (ctx.variant as any).metadata?.custom ?? undefined16 }1718 if (ctx.type === "product") {19 line["Custom Product Field"] = (ctx.product as any).metadata?.custom ?? undefined20 }2122 return line23 },24 },25 },26 },27 ],28})
— Additional Medusa product fields to fetch and make available inside . Uses the same dot-notation field paths as Medusa's .
1extraProductFields: [2 "metadata",3 "variants.metadata",4 "images.url",5 "collection.title",6]
1(line: Record<string, unknown>, ctx: FeedLineContext) =>2 Record<string, unknown> | Promise<Record<string, unknown>>
Called for every line written to the feed. Use it to add, remove, or transform fields. The argument provides typed access to the raw product and variant data:
1type FeedLineContext =2 | { type: "variant"; product: Record<string, unknown>; variant: Record<string, unknown>; variantIndex: number }3 | { type: "product"; product: Record<string, unknown> }
Fields that resolve to are automatically stripped from the output.
Both endpoints require an authenticated admin JWT.
| Method | Path | Description |
|---|---|---|
| Retrieve the current configuration | ||
| Create or update the configuration |
MIT — Seeed