Easily move contacts between MailChimp lists in your Rails 3 application.


A MailChimp account and API key.



  1. Gemfilegem "chimpactions", "~> 0.0.1"
  2. rails generate chimpactions:install
  3. Edit config/chimpactions.yml with your information.
  4. add include Chimpactions::Subscriber to your model.
  5. add after_save :chimpactions (if that’s what you want) to your model.

The YourModel.chimpactions method fires the actions to move subscribers as specified.


  • config/chimpactions.yml config file

ActiveRecord store

rails generate chimpactions:migration

rake db:migrate


  • chimpactions ActiveRecord migration

Customizing Admin

Chimpactions provides a basic scaffold for managing ActiveRecord Actions @ http:yourapp/chimpactions. To override the gem views :

rails generate chimpactions:customize


  • chimpactions view files for administrative interface
  • yourapp/app/views/chimpactions


See installed config/chimpactions.yml for configuration options


What’s available

Once defined (in chimpactions.yml) the local Rails model inherits the following methods from the Chimpactions gem :

  • add_to(List)
  • move_to(List)
  • remove_from(List)

A Chimpaction :

WHENN (A model method/attribute) IS (<,>,=) VALUE, ACTION (Chimpactions method) LIST (One of your MailChimp Lists)


‘When a user has more than 50 posts, move them to the Power Poster list’

in chimpactions.yml

    action: :move_to,
    list: Power Posters,
    whenn: posts.count,
    is: >,
    value: 50

for ActiveRecord store The admin interface should be a straightforward representation.

Administrative Interface

Direct your browser to http://yourapp.chimpactions for a simple CRUD to build and manage Actions. Available values are set in the forms where applicable, validations will tell you if a value won’t work.

Manual access

You can move subscribers around arbitrarily as well:

user = User.find(123)
user.remove_from("Power Posters") 

Chimpactions Module

All your lists with a ton of info:

@lists = Chimpactions.available_lists
<%= var_dump(@lists) ->

Calling the MailChimp API directly:

Direct access to the gibbon socket :

api_result = Chimpactions.socket.campaigns({:start => 0, :limit => 100})


To register your application with your MailChimp List direct your browser to : http://yourapp/chimpactions/webhooks

The links next to each list will add/delete the webhook http://yourapp/chimpactions/receive to that list.

You must handle the post itself in

in your mix-in model for it have an effect.


  • implement VCR for tests so we don’t have to use a real API key
  • get loading don’t so we don’t have to add include Chimpactions::Subscriber in the model


This project released under the MIT-LICENSE.


Made possible by the generous support of the MailChimp Integration Fund .


© circuitllc & imgenius 2011 – Released under the MIT license.