Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

mailchimp

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.

like image 574
Kit Sunde Avatar asked Feb 04 '13 12:02

Kit Sunde


People also ask

How do I send an email to multiple groups in Mailchimp?

Click the first drop-down menu and choose a group category. Click the second drop-down menu and choose whether to send to contacts who are in one of, all of, or none of the group names. Click the group name you want to send to. Click and hold CMD or CTRL to select more than one group name.

Can you send a Mailchimp email to multiple audiences?

As a best practice, we recommend you maintain only one primary audience in Mailchimp, and use tags and segments to organize and target your contacts. If you have multiple audiences, you can use our combine audiences tool to merge them together.

What can I do with Mailchimp API?

The Mailchimp Marketing API provides programmatic access to Mailchimp data and functionality, allowing developers to build custom features to do things like sync email activity and campaign analytics with their database, manage audiences and campaigns, and more. To use the Marketing API, you need a Mailchimp account.


1 Answers

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);
like image 113
Brett DeWoody Avatar answered Oct 16 '22 11:10

Brett DeWoody