MailChimp Lists - the Meteor way.
See also these wrappers:
- miro:mailchimp - A Meteor wrapper for the MailChimp API
miro:mailchimp-lists helps you to manage mailing lists.
Further information on the MailChimp API and its features is available at https://github.com/gomfunkel/node-mailchimp.
miro:mailchimp-lists also exposes one template you can use out of the box:
{{> MailChimpLists}}, which will render all mailing lists for a given API Key.
Install using Meteor:
meteor add miro:mailchimp-lists // It will add miro:mailchimp package
// if not not already installedUse in your template:
<div id="mailChimpLists">
<!-- There's also another utility template
you can use to refresh the list -->
{{> MailChimpListsRefresh}}
{{> MailChimpLists}}
</div>Put in your server's settings.json:
{
"private": {
"MailChimp": {
"apiKey": "<Your MailChimp API Key>",
"listId": "<ID of your default mailing list>"
}
}
}and start your server with:
meteor --settings settings.jsonMailChimpLists at the moment exposes the following methods both server- and client-side:
NOTE: If
callbackis ommited server-side, the method runs "synchronously" viaMeteor.wrapAsyncmethod.
List all mailing lists for a given API Key
paramsParameters to pass to the API method.callbackCallback function for returned data or errors with two parameters. The first one being an error object which is null when no error occured, the second one an object with all information retrieved as long as no error occured.
Subscribe email to the list
paramsParameters to pass to the API method.callbackCallback function for returned data or errors with two parameters. The first one being an error object which is null when no error occured, the second one an object with all information retrieved as long as no error occured.
Unsubscribe email from the list
paramsParameters to pass to the API method.callbackCallback function for returned data or errors with two parameters. The first one being an error object which is null when no error occured, the second one an object with all information retrieved as long as no error occured.
List recipient groups for a given list
paramsParameters to pass to the API method.callbackCallback function for returned data or errors with two parameters. The first one being an error object which is null when no error occured, the second one an object with all information retrieved as long as no error occured.
methodThe method to call in the given section.paramsParameters to pass to the API method.callback(optional server-side, required client-side) Callback function for returned data or errors with two parameters. The first one being an error object which is null when no error occured, the second one an object with all information retrieved as long as no error occured.
List all lists for a given API Key
Refresh list of all lists for a given API Key
// You can as well pass different parameters on each call
var mailingLists = new MailChimpLists( /* apiKey, { version : '2.0' } */ );
mailingLists.list(
{ /*
filters: {
list_id: '<some_list_id>'
},
start: 0,
limit: 100,
sort_field: '',
sort_dir: '' */
},
// Callback beauty in action
function ( error, result ) {
if ( error ) {
console.error( '[MailChimpLists][List] Error: %o', error );
} else {
// Do something with your data!
console.info( '[MailChimpLists][List]: %o', result );
}
}
);// You can as well pass different parameters on each call
var mailingLists = new MailChimpLists( /* apiKey, { version : '2.0' } */ );
var result = mailingLists.list(
{ /*
filters: {
list_id: '<some_list_id>'
},
start: 0,
limit: 100,
sort_field: '',
sort_dir: '' */
}
);
// Do something with your data!
console.info( '[MailChimpLists][Lists]:\n', JSON.stringify( result ) );- Update to Meteor v1.0
- On client, MailChimpLists.call() now reads API Key from session variable 'MailChimp.apiKey'
- Cleanup
- On client, MailChimp.call() now reads API Key from session variable 'MailChimpOptions.apiKey' as well
- Initial release
Copyright © 2014-2015 Miroslav Hibler
miro:mailchimp-lists is licensed under the MIT license.