Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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