3

I cannot seem to figure out how to send to a group in my list using mailChimp API

My code looks like this:

$conditions = array('field'=>'interests-1', 'op'=>'all', 'value'=>'myGroup');
$opts = array('match'=>'any', 'conditions'=>$conditions);
$retval =  $api->campaignSegmentTest($listId, $opts);

But this yields bool(false). When fetched by

 $retval = $api->listInterestGroupings($listId);

my list looks like this:

array(1) {
  [0]=>
  array(5) {
    ["id"]=>
    int(1)
    ["name"]=>
    string(10) "myList"
    ["form_field"]=>
    string(5) "radio"
    ["display_order"]=>
    string(1) "0"
    ["groups"]=>
    array(5) {
      [0]=>
      array(4) {
        ["bit"]=>
        string(1) "1"
        ["name"]=>
        string(9) "myGroup"
        ["display_order"]=>
        string(1) "1"
        ["subscribers"]=>
        int(1)
      }
      [1]=>
      array(4) {
        ["bit"]=>
        string(1) "2"
        ["name"]=>
        string(9) "myGroup_2"
        ["display_order"]=>
        string(1) "2"
        ["subscribers"]=>
        int(1)
      }
    }
  }
}

I have looked in the API documentation and searched for the answer, but cannot seem to figure it out. Grateful for help!

Mephisto73
  • 31
  • 2

1 Answers1

1

Looks like you are using the PHP wrapper - the first thing to do, like the examples included with it do, is to check for any errors by looking at $api->errorCode before messing with the $retval.

When you do that I'm certain you will see an error telling you that you haven't passed a proper "conditions" parameter since it is an array of arrays, not an array.

jesse
  • 470
  • 2
  • 6