Last updated by Malte Hübner 1 year ago
grails install-plugin gchimp-plugin
or...
Download it manually and...
grails install-plugin /path/to/download-folder/grails-gchimp-plugin-0.2.1.zip
New releases:
I'll post new releases of this plugin on twitter:
http://twitter.com/malte_huebner
Last updated by Malte Hübner 1 year ago
Welcome to the Grails Gchimp Plugin!
This plugin currently supports only some basic MailChimp API 1.2-Methods like subscribe, unsubscribe, lists, memberInfo...
How to use this plugin:
First, install it as described under "Installation".
Next, just add some configuration vars to your Config.groovy. These are:
gchimp.apiUrl = 'https://api.mailchimp.com:443/1.2/'
gchimp.apiKey = 'YOUR_API_KEY'
gchimp.defaultListId = 'YOUR_LIST_ID'
gchimp.encoding = 'UTF-8'
After these are set, just wire the gChimpService into your Controller like this:
class GchimpController { def gchimpService
}Now you are ready to use methods of GchimpService.
Just check it out, it's really simple.
Have fun with this plugin!
Sample controller
This is just a rudimental sample to demonstrate the simplicity of this plugin. Do not use it in production mode!
import com.nwire.mailchimp.IMailChimpServices;/**
* @author Malte Hübner, innobox web engineering
*
*/class GchimpController { def gchimpService def afterInterceptor = { model ->
def apiKey = gchimpService.apiKey
def keySize = apiKey.size()
def maskSize = keySize - 8 model.apiKey = '*' * maskSize + apiKey[maskSize..keySize-1]
model.defaultListId = gchimpService.defaultListId
} def index = {
def ping = gchimpService.ping() if (IMailChimpServices.PING_SUCCESS.equals(ping)) {
flash.message = "MailChimp connection pinged successfully"
} else {
flash.message = "Failed to ping MailChimp, response: " + ping
}
} def lists = {
def lists = gchimpService.lists(); return [lists:lists]
} def memberInfo = {
if(!params.email) {
throw new IllegalArgumentException("Param email is missing")
} def memberInfo = gchimpService.listMemberInfo(params.email); return [memberInfo:memberInfo] } def subscribe = {
if(!params.email) {
throw new IllegalArgumentException("Param email is missing")
} def res = gchimpService.listSubscribe(params.email); if(res) {
flash.message = 'subscription successful'
} else {
flash.message = 'subscription not successful'
} return [:] } def unsubscribe = {
if(!params.email) {
throw new IllegalArgumentException("Param email is missing")
} def res = gchimpService.listUnsubscribe(params.email); if(res) {
flash.message = 'unsubscription successful'
} else {
flash.message = 'unsubscription not successful'
} return [:] }
}
Last updated by Malte Hübner 2 years ago
FAQ
Are all MailChimp API 1.2 methods supported by the plugin?
No, not all but the currently supported methods are the most important ones:
- apiKeyExpire,
- campaignCreate,
- campaignSendNow,
- campaignTemplates,
- defaultListId,
- getMetaClass,
- getProperty,
- invokeMethod,
- listMemberInfo,
- listMembers,
- lists,
- listSubscribe,
- listUnsubscribe,
- listUpdateMember,
- login,
- ping
Last updated by admin 2 years ago