I have created a rails app with rails 3.2 and ruby 2.1.2. I have used gibbon gem for accessing mail chimp API for create/edit/delete mail chimp list and also to manage subscribers. I am unable to create new mail chimp list using methods provided by gibbon. But I am able to get already created(default lists in mail chimp web app) lists. I want to know how to create a mail chimp list. I did not find examples for the same in github page.
Asked
Active
Viewed 1,167 times
0
-
why You have to need to create list – Kaushlendra Tomar Nov 12 '16 at 09:22
-
I need to send mail for particular group of users, so that I am creating list for store that users list. – Premanandh Selvakumarasamy Nov 12 '16 at 11:00
-
I think you should create a list at the mailchimp and after that you will got list ID and in this list you will add the users for the mail – Kaushlendra Tomar Nov 12 '16 at 13:07
-
No. I don't want to create list manually and list should be added dynamically and list id should be maintained in database. – Premanandh Selvakumarasamy Nov 12 '16 at 13:35
1 Answers
1
Eventually I got the solution. I can create mail chimp list using following code by using Gibbon 2.2.4.
gibbon = Gibbon::Request.new()
params = {
"name" => name,
"contact" => {
"company" => "Your Company",
"address1" => "address one",
"address2" => "address two",
"city" => "city",
"state" => "state",
"zip" => "zip-code",
"country" => "country name",
"phone" => "phone"
},
"permission_reminder" => "You are receiving this email, because you subscribed our product.",
"campaign_defaults" => {
"from_name" => "Test user",
"from_email" => "testuser@test.com",
"subject" => "",
"language" => "en"
},
"email_type_option" => true
}
mail_chimp_list = gibbon.lists.create(body: params)
my gibbon.rb file looks like
Gibbon::Request.api_endpoint = "https://****.api.mailchimp.com"
Gibbon::Request.api_key = "api-key"
Gibbon::Request.timeout = 15

Premanandh Selvakumarasamy
- 1,332
- 7
- 27