Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/itsthatguy/mailchimp-subscription-middleware

Middleware to enable server-side mailchimp subscription requests
https://github.com/itsthatguy/mailchimp-subscription-middleware

Last synced: about 6 hours ago
JSON representation

Middleware to enable server-side mailchimp subscription requests

Awesome Lists containing this project

README

        

# MailChimp Subscription Middleware

## Assumptions
* You have a mailchimp account
* You've created a list
* You have an API Key
* You know what a computer is

## Use it
* API key
http://kb.mailchimp.com/integrations/api-integrations/about-api-keys
* List ID http://kb.mailchimp.com/lists/managing-subscribers/find-your-list-id
**Do not** remove the `-` at the end of your API token

```javascript
// express.js example
var mcSubscriber = require('mailchimp-subscription-middleware');

var options = {
apiKey: 'abcdefghijklmnopqrstuvwxyz123456-us12',
listId: '9e67587f52'
};

app.use('/subscribe', mcSubscriber(options));
```

```javascript
// browsersync example
// assumes that you have browsersync setup. This only shows how to use the
// middleware in your existing setup
// https://www.browsersync.io/docs/options/
var mcSubscriber = require('mailchimp-subscription-middleware');

var options = {
apiKey: 'abcdefghijklmnopqrstuvwxyz123456-us12',
listId: '9e67587f52'
};
var browserSyncOptions = {
...
middleware: [{
route: '/subscribe',
handle: mcSubscriber(options)
}]
...
};
```

## Response

```javascript
{
"data":
}
```