* - Refactored the .js files to .ts files - Added typing - Used 'WrapHandler' util instead of specific middleware in plugin - Added additional PUT method to the /mailchimp/subscribe endpoint. - Updated documentation where relevant. * Added changeset * Updated yarn.lock * Used camelcase for method args in services/mailchimp.ts --------- Co-authored-by: Tom Rupke <tom@adapptive.nl> Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
1.6 KiB
1.6 KiB
Mailchimp
Manage newsletter subscriptions in your commerce application with Mailchimp.
Mailchimp Plugin Documentation | Medusa Website | Medusa Repository
Features
- Allow customers to subscribe to your newsletter.
- Provides custom services and endpoints to give developers flexibility in how to implement newsletter subscription.
Prerequisites
How to Install
1. Run the following command in the directory of the Medusa backend:
npm install medusa-plugin-mailchimp
2. Set the following environment variables in .env:
MAILCHIMP_API_KEY=<YOUR_API_KEY>
MAILCHIMP_NEWSLETTER_LIST_ID=<YOUR_NEWSLETTER_LIST_ID>
3. In medusa-config.js add the following at the end of the plugins array:
const plugins = [
// ...,
{
resolve: `medusa-plugin-mailchimp`,
options: {
api_key: process.env.MAILCHIMP_API_KEY,
newsletter_list_id: process.env.MAILCHIMP_NEWSLETTER_LIST_ID,
},
},
]
Test the Plugin
1. Run the following command in the directory of the Medusa backend to run the backend:
npm run start
2. Use the POST or PUT /mailchimp/subscribe endpoint or the MailchimpService to subscribe to the newsletter.