1

Anyone got an example on how to use mailchimp 2.0 interest-groupings I'm using the Gibbon gem in rails.

I tried below code.

Gibbon::API.lists.listInterestGroupings({:id => listId})

I get the following error. Gibbon::MailChimpError: MailChimp API Error: Unknown method "lists/listinterestgroupings" (code -32601)

I',m able to subscribe to my list using mailchimp subscribe method but when I try to pass it merge vars for groupings then it just saves it to the list but not my group

@merge_vars = ['GROUPINGS' => ['id' => listId, 'groups' => @myGroupName ]];
Gibbon::API.lists.subscribe({:id => listId, :email => {email:address}, :email_type => "html", :merge_vars => @merge_vars, :double_optin => false, :update_existing => true, :send_welcome => true}) 

Anyone ever get this to work. Please help this is driving me crazy.

Chapsterj
  • 6,483
  • 20
  • 70
  • 124

1 Answers1

3

That's the way to use that method:

Gibbon::API.lists.interest_groupings(:id => listID)

from there you can get all the groups of the list, and get the group id that needs to be used in mergevars

@merge_vars = { :GROUPINGS => [{ :id => group_id, :name => "Group name", :groups => ['subgroup name']}] }

then just call your subscribe method

Gibbon::API.lists.subscribe({:id => listId, :email => {email:address}, :email_type => "html", :merge_vars => @merge_vars, :double_optin => false, :update_existing => true, :send_welcome => true})
danishh
  • 31
  • 2