Integrating with Mailchimp

Pro version only

If you use Mailchimp SpeakOut! can automatically add signers to your audience (your list) if they check the “Add to mailing list” option, assuming you have it enabled and have Mailchimp enabled in the petition settings.

The only fields sent to mailchimp are first name, last name, email address and country. If enough people request an additional field, I will consider adding it.

To enable Mailchimp go to dashboard > SpeakOut! > petitions > edit the petition > 3rd Party Extras tab. Checking the box will expose 3 fields that you need to find and enter.

API Key - https://mailchimp.com/help/about-api-keys/#Find_or_generate_your_API_key
Server ID - can be found at the end of the API key e.g. if your API Key is 49bb05729a55e6a1df41c49bb683-us6, then your server ID is us6
Audience/List ID - this is easy to find: https://mailchimp.com/help/find-audience-id

If you have the 2FA setting enabled, your new audience member (their terminology) will receive an email to confirm their address.

There are 2 likely scenarios that you may have. A single campaign with a number of petitions or a number of separate campaigns, each with its own petition.

In scenario 1, a single campaign, use the same Mailchimp API details for each petition.

If you have separate campaigns, assuming they are all in the same Mailchimp account, the only thing to change is the list ID for each petition. The API Key and server ID will be the same.

NOTE: for this to work, you must enable the ‘Display opt-in checkbox’ under the Display Options tab on the edit petition page. i.e. you can’t add people to your mailing list without their permission.

But…emails aren’t being added to my list!

There are so many reasons this could be happening, we need to discover what is going on. To do that we get WordPress to email the site administrator (you?) with the details of the error.

Open for editing /wp-content/plugins/speakout/includes/class.mail.php – go to line 366 or thereabouts where you should find:

        //mail(get_option('admin_email'),"Mailchimp error", "There has been an error adding an email address (" . $email . ") to Mailchimp in the SpeakOut! plugin - response status " . $response->status);

replace that line with two lines

        $responseOutput = print_r($response, true);
        mail(get_option('admin_email'),"Mailchimp error", "There has been an error adding an email address (" . $email . ") to Mailchimp in the SpeakOut! plugin - the error is: " . $responseOutput . ". You may need to send this to Steve via https://SpeakOutPetitions.com/contact");

If you do receive an error message do a search for what it means, e.g. mailchimp error “Your merge fields were invalid” and if you can’t make sense of it, send it to me. FWIW the above error is sometimes caused by mailchimp set up to require something like postal code, which isn’t sent by SpeakOut!.

This is the way to do debugging in 105.2.2. In future versions this will be an option that can be enabled in the plugin when you enable MailChimp.