Last active
May 9, 2016 21:11
-
-
Save craigquincy/ccd82d032b1feef983bdefccacebe9c4 to your computer and use it in GitHub Desktop.
Example of how to create a Mailchimp list through the gibbon api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create lists in mailchimp using gibbon gem (not currently inthe docs) | |
lists = [ | |
"Climbing", | |
"Fly Fishing", | |
"Gear" | |
] | |
gibbon = Gibbon::Request.new | |
lists.each do |list| | |
body = | |
{ | |
name: list, | |
email_type_option: false, | |
contact: { | |
company: 'YOUR COMPANY', | |
address1: 'YOUR ADDRESS', | |
address2: '', | |
city: 'YOUR CITY', | |
state: 'CO', | |
zip: '80205', | |
country: 'US', | |
phone: '', | |
abuse_name: 'Someone', | |
abuse_email: '[email protected]' | |
}, | |
campaign_defaults: | |
{ | |
from_name: 'YOUR COMPANY', | |
from_email: '[email protected]', | |
subject: list, | |
language: 'en' | |
}, | |
permission_reminder: "You signed up for the " + list | |
} | |
result = gibbon.lists.create(body: body) | |
Rails.logger.debug(list + " successfully created") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment