@vagalumedigital/gatsby-plugin-mailchimp-api
v0.0.16
Published
A plugin written to use Mailchimp API v3 to add/update users subscribed on a list
Downloads
17
Maintainers
Readme
UNDER DEVELOPMENT DO NOT USE
Intro
This is a plugin developed to manage your contacts on your audience. This plugins add a user to your audience or update it if it exists already.
We have some plans to expand this plugin and fully integrate with Mailchimp API, allowing you to use a full featured mailchimp integration in your Gatsby sites. Feel free to send suggestions :blush:
This plugin was based on Benjamin Hoffman's gatsby-plugin-mailchimp and Rohov Dmytro's gatsby-source-mailchimp. I recommend you to check those plugins, maybe they will help you too.
Installation
yarn add @vagalumedigital/gatsby-plugin-mailchimp-api
Usage
gatsby-config.js
[
{
resolve: `gatsby-plugin-mailchimp-api`,
options: {
id: '<ID-OF-YOUR-MC-LIST>', // string; ID of your mailchimp list found on your list settings
key: '<MC-API-KEY>', // string; You can find your API key in account settings of your mailchimp account.
}
}
];
Import the module on your code
import { addToMailchimp } from '@vagalumedigital/gatsby-plugin-mailchimp-api'
Then add the following code to your form submit:
addToMailchimp(
// email
'[email protected]',
// merge fields
{
'FNAME': 'John',
'LNAME': 'Doe',
},
// interests. The ID of the interest is the key of the object. Remember, it's a object not a array!
{ ff8fc8c005: false },
).then(data => console.log(data));
If you want to get the interests of the list you're subscribing into, you can call:
import { getInterests } from '@vagalumedigital/gatsby-plugin-mailchimp-api'
getInterests()