Web callback hooks for the Mailchimp api
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



The pant-hoot is a vocalization of chimpanzees that begins with breathy, low-pitched hoots that makes a transition into a series of quicker, higher-pitched in-and-out pants building to a loud climax.

Pant-hoot is a gem that provides the API MailChimp expects for its webhooks, and then passes on those notifications to you in a sensible, Ruby-infused manner. If you’re using Rails, then it functions as a Rails Engine. Otherwise, you’ll have a Rack app to use as you see fit.


Add the gem to your Gemfile:

gem 'panthoot', '~> 0.2.0'

If you’re using Rails, this will automatically add a route at /panthoot/hooks to capture messages from MailChimp. Otherwise, mount the Rack app Panthoot::App.new to wherever you like. Make sure you add that URL to your MailChimp account settings, otherwise this will all be for naught.

The next step is to tell Panthoot that you want to be informed whenever MailChimp sends something your way. In Rails, stick the configuration in an initializer, but for Rack just make sure it’s set as part of your app load process.

ActiveSupport::Notifications.subscribe('subscribe.panthoot') do |*args|
  event        = ActiveSupport::Notifications::Event.new(*args)
  subscription = event.payload[:subscribe]
  fired_at     = event.payload[:fired_at]

  # use subscription data however you wish

The above sample is just listening to new subscriptions, but there’s other events as well – the event prefix matches the payload key in each case:

  • subscribe
  • unsubscribe
  • profile_update
  • email_address_change
  • email_cleaned
  • campaign_sending_status

As you can see in the example, each notification will provide an object with all the data from MailChimp, plus the time the notification was fired. When the notification is fired, you get to do your thing with the data provided. Have fun!


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Pull requests without tests may be rejected purely on that basis. You’ve been warned.


Copyright © 2013, Panthoot is developed and maintained by Pat Allan on behalf of Inspire9, and is released under the open MIT Licence.