docs: added dividers + see also section (#2899)

This commit is contained in:
Shahed Nasser
2022-12-26 15:52:08 +02:00
committed by GitHub
parent b0e5769e27
commit b0ebfd6bcf
100 changed files with 1047 additions and 291 deletions
+16 -2
View File
@@ -14,12 +14,16 @@ This plugin is only used to allow your customers to subscribe but does not actua
:::
---
## Prerequisites
Before going further with this guide make sure you have a Medusa server set up. You can follow the [Quickstart guide](https://docs.medusajs.com/quickstart/quick-start).
You also need a Mailchimp account, so please [create one](https://mailchimp.com/signup) before you start.
---
## Obtain Mailchimp Keys
To integrate the plugin into Medusa you need two keys: The API Key and the Newsletter list or Audience ID. The API Key acts as a credential for your account, whereas the Newsletter list ID determines which audience should the subscribed customers be added to.
@@ -28,6 +32,8 @@ You can follow [this guide](https://mailchimp.com/help/about-api-keys/#Find_or_g
You can follow [this guide](https://mailchimp.com/help/find-audience-id/) from Mailchimps documentation to obtain your Newsletter list or Audience ID.
---
## Install the Plugin
In the directory of your Medusa server, run the following command to install the Mailchimp plugin:
@@ -64,6 +70,8 @@ const plugins = [
];
```
---
## Test it Out
This plugin adds a new `POST` endpoint at `/mailchimp/subscribe`. This endpoint requires in the body of the request an `email` field. You can also optionally include a `data` object that holds any additional data you want to send to Mailchimp. You can check out [Mailchimps subscription documentation](https://mailchimp.com/developer/marketing/api/list-members/add-member-to-list/) for more details on the data you can send.
@@ -101,6 +109,8 @@ Heres an example of sending additional data with the subscription:
All fields inside `data` will be sent to Mailchimps API along with the email.
---
## Use Mailchimp Service
If you want to subscribe to users without using this endpoint or at a specific place in your code, you can use Mailchimps service `mailchimpService` in your endpoints, services, or subscribers. This service has a method `subscribeNewsletter` which lets you use the subscribe functionality.
@@ -122,6 +132,8 @@ You can learn more about how you can use services in your endpoints, services, a
:::
---
## Add Subscription Form
This section has a simple example of adding a subscription form in your storefront. The code is for React-based frameworks but you can use the same logic for your storefronts regardless of the framework you are using.
@@ -177,7 +189,9 @@ This will result in a subscription form similar to the following:
If you try entering an email and clicking Subscribe, the email will be subscribed to your Mailchimp newsletter successfully.
## Whats Next
---
## See Also
- Check out [SendGrid plugin](../add-plugins/sendgrid.mdx) for more Email functionalities.
- [Learn more about plugins.](../advanced/backend/plugins/overview.md)
- [Plugins Overview](../advanced/backend/plugins/overview.md)