SHIP IT FASTER

The average enterprise on Netlify ships 140 times per week. Where does your team rank?

ContactSign Up
Community Plugin
View plugin on GitHub

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@example.com',
  // 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()
© 2023 Gatsby, Inc.