# Integrating with Mailchimp

Let’s say you’d like to have a capture form and them add them to a Mailchimp (or other email subscriber) list… it’s easy:

1\) Create your form in your Buzzy microapp

<div align="left"><img src="https://1771273900-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3HPEoFCyP7Q88dV3CmqD%2Fuploads%2FRoipKfwX6A7wjy02xw2t%2Ftip1?alt=media" alt=""></div>

Resulting in

<div align="left"><img src="https://1771273900-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3HPEoFCyP7Q88dV3CmqD%2Fuploads%2FxL1IhFnKt697dudVsKaG%2Ftips2?alt=media" alt=""></div>

2\) You’ll need the details to make a REST API call to your list sever. For example, with Mailchimp, you’ll first need to [get an API key](https://mailchimp.com/help/about-api-keys/?utm_source=mc-api\&utm_medium=docs\&utm_campaign=apidocs&_ga=2.173762212.600914683.1551221719-1533229241.1551221719&_gac=1.229237032.1551257382.EAIaIQobChMIjbnfhsTb4AIVwxx9Ch0G2QAUEAAYASAAEgLjWfD_BwE)

Next we need to know what the API url will look like `https://<dc>.api.mailchimp.com/3.0/lists/<list_id>/members/`

You’ll need to know what the `<dc>` bit is, with are the last few characters of your API key you generated above after the minus `-` sign. For example

For example if your API key is something like `<somlongstring>-us20` the `dc` but is the `us20`. So your API url should be `https://us20.api.mailchimp.com/3.0/lists/<list_id>/members/`

No you just need the `<list_id>` which you can get by going to the `List name and campaign defaults` and you should be able to see your list id

<figure><img src="https://1771273900-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3HPEoFCyP7Q88dV3CmqD%2Fuploads%2FbXdKYt9jwtJ8DbzTkAft%2Ftips3.png?alt=media&#x26;token=207d48ed-bcc8-4359-84c2-134ea78ca3aa" alt=""><figcaption></figcaption></figure>

Let’s pretend it’s `12345`

So now you should be able to generate a api call to add a member to a list with `https://us20.api.mailchimp.com/3.0/lists/12345/members/`

3\) Create a rule when a new row is submitted with a `Send to JSON` `POST` request, like so

<figure><img src="https://1771273900-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3HPEoFCyP7Q88dV3CmqD%2Fuploads%2F91TqU3pbDbpPMPPXHRFo%2Ftips4.png?alt=media&#x26;token=558fb445-8713-4cdf-87be-811f4ac6eea9" alt=""><figcaption></figcaption></figure>

For the `username` you can user anything. For the password use your API key you generated in Mailchimp in step 2 above

for the `JSON` bit use this as the minimum, passing any additional fields to Mailchimp for display

```
{
    "email_address": "{{{email}}}",
    "status": "subscribed",
    "merge_fields": {
        "FNAME": "{{{First Name}}}",
        "LNAME": "{{{Last Name}}}"
    }
}
```

Note the fields `email`, `First Name` and `Last Name` match to the labels in your Buzzy form fields. Use trile curly braces `{{{<field name>}}}` when you want to pass the exact value, use double braces `{{<field name>}}` for fields that may contain special characters (eg multi line text fields)

4\) Test the Form by submitting a new item, you should see a new subscriber be added to the list in Mailchimp

***
