Joe Joe - 1 year ago 298
PHP Question

MailChimp API PHP - Add to Interest Group

I'm currently using the MailChimp API for PHP, version 1.3.1 (

I've set up a list in MailChimp, and would like to dynamically add:

  1. Subscribers to the list (done:
    $objMailChimp->listBatchSubscribe($strMailingListID, ...)

  2. Interest Groupings (done:
    $objMailChimp->listInterestGroupingAdd($strMailingListID, ...)

  3. Interest Groups into those Groupings (done:
    $objMailChimp->listInterestGroupAdd($strMailingListID, ...)

  4. Subscribers assigned to relevant Groups (not done)

The API ( is somewhat unclear on how to add a subscriber to an interest group - does anyone here have any ideas?


Answer Source

As of version 2.0 of MailChimp's API, this should work:

$merge_vars = array(
    'GROUPINGS' => array(
            'name' => "GROUP CATEGORY #1", // You can use either 'name' or 'id' to identify the group
            'groups' => array("GROUP NAME","GROUP NAME")
            'name' => "GROUP CATEGORY #2",
            'groups' => array("GROUP NAME")


Using a barebones PHP wrapper ( you can then send this to MailChimp via either the lists/subscribe or lists/batch-subscribe:

$MailChimp = new MailChimp('API_KEY');
$result = $MailChimp->call('lists/subscribe', array(
      'id'                => 'LIST ID',
      'email'             => array('email'=>''),
      'merge_vars'        => $merge_vars
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download