Kit Sunde
Kit Sunde

Reputation: 37055

How can I use the MailChimp api to send emails to groups?

I would like to group my users by "Newsletter", "Users" and "Members" and send emails out via the API, how can I make that possible: http://apidocs.mailchimp.com/api/1.3/index.php

Adding users to groups seem fairly straight forward, but I can't seem to find how to send to them. Neither createCampaign nor campaignSendNow has any mentions of groups or how to send to them.

Currently I'm handling this by having 3 seperate lists.

Upvotes: 10

Views: 3227

Answers (1)

Brett DeWoody
Brett DeWoody

Reputation: 62743

You'll need to use the segment_opts parameter in the campaignCreate() method to select the groups (ie segments) you want to send to.

Using the segment_opts parameter you can select specific groups. Something like this:

// Assuming your interest group has an ID of 1.

$conditions = array();
$conditions[] = array('field'=>'interests-1', 'op'=>'one', 'value'=>'Newsletter');
$segment_opts = array('match'=>'all', 'conditions'=>$conditions);

$retval = $api->campaignCreate($type, $opts, $content, $segment_opts);

Upvotes: 13

Related Questions