- Š”ontroller for web hooks NOTE: now support only unsubscribe hook
Add this line to your application's Gemfile: gem 'mailchimp-rails', git: 'https://github.com/Kr00lIX/mailchimp_rails.git'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mailchimp
rails generate mailhimp:install
This will generate the initializer file.
Declare mailchimp_user on your user model: class User < ActiveRecord::Base
mailchimp_user do |user|
# describe mailchimp's params
{
EMAIL: user.email,
NAME: user.full_name
}
end
end
Add Mailchimp web hooks routes:
Site::Application.routes do
match 'api/unsubscribe' => Mailchimp.routes
end
and add http://{site_hostname}/api/unsubscribe
url to mailchimp webhooks panel
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request