/grails-mailchimp

Grails plugin that wraps the Mailchimp API and Mailchimp STS API for convenience

Primary LanguageGroovyApache License 2.0Apache-2.0

Grails Mailchimp Plugin

A thin API wrapper for the Mailchimp API 1.3 and Mailchimp STS API 1.0.

Exposes a service for each API:

Configuration

In your Config.groovy you need the following lines:

	mailchimp.apiUrl = 'YOUR API endpoint' // e.g. 'https://us2.api.mailchimp.com/1.3/' but this depends on which datacentre your API key is valid for
	mailchimp.apiKey = 'YOUR API KEY'
	mailchimp.defaultListId = 'YOUR DEFAULT LIST ID'

API reference:

There are a lot of API methods so I suggest looking them up in the Mailchimp docs and checking in the appropriate Service method

Examples

API Endpoints are then exposed as service methods, each expecting at least a closure (depending on the required arguments of that method)

Simple call

	mailchimpService.lists { res, json ->
		println res.data
		println json
	}		

With an argument (check the Mailchimp API docs and relevant service method to see what the arguments should look like)

	mailchimpService.campaignsForEmail "some.email@address.com", { res, json ->
		println res.data
		println json
	}