Skip to content

Instantly share code, notes, and snippets.

@craigquincy
Last active May 9, 2016 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigquincy/ccd82d032b1feef983bdefccacebe9c4 to your computer and use it in GitHub Desktop.
Save craigquincy/ccd82d032b1feef983bdefccacebe9c4 to your computer and use it in GitHub Desktop.
Example of how to create a Mailchimp list through the gibbon api
# 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: 'someone@something.com'
},
campaign_defaults:
{
from_name: 'YOUR COMPANY',
from_email: 'no-reply@something.com',
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