Mailchimp
Send form sign-ups to a Mailchimp audience with mapped fields, tags, groups and marketing permissions.
Mailchimp adds or updates a contact in a Mailchimp audience each time a form is submitted. You choose the audience, map form fields to audience fields, and can add tags, groups and marketing permissions. It needs XPAC Forms.
Connect Mailchimp
In Mailchimp, click your profile icon, choose Profile, then Extras → API keys, and click Create A Key. Copy the key right away: Mailchimp shows it only once.
In WordPress, go to XPAC → Integrations → Mailchimp, paste the key into
API key and save. Paste the whole key, including the ending such as
-us21. Admins can see the saved key on this screen.
Click Test connection. It checks the key with Mailchimp and shows how many audiences it found. It sends nothing. An incomplete key gets a message saying so.
Register webhooks is optional. It asks Mailchimp to tell this site when a contact unsubscribes, bounces or changes their details. It covers every audience, needs a site Mailchimp can reach, and is safe to run again. Only custom code uses these events (see For developers). Tools → Export Personal Data and Tools → Erase Personal Data cover what they store.
Add it to a form
Edit the form, open the Mailchimp panel in the sidebar and click Add Mailchimp action.
- Audience: where the contact goes. Audiences and their fields are kept for 10 minutes. Click Reload from Mailchimp to fetch them again.
- New contact status: Pending (email confirmation) sends Mailchimp's confirmation email and is the default for new actions. Subscribed (no confirmation) adds people straight away. Non-subscribed (no marketing consent) adds them without marketing consent. Existing contacts keep their status.
- Field mapping: pair each Form field with a Mailchimp field. One row must map to Email address. The editor flags required audience fields you have not mapped, and warns when two rows use the same Mailchimp field: only the first is sent.
- An address needs its street, city, state and ZIP or postal code mapped together. A Date field sent to a birthday field goes out as MM/DD.
- Blank answers are not sent, so they never clear what Mailchimp already holds.
- Tags: added to the contact. New tags are created in Mailchimp.
- Groups: shown when the audience has groups. The contact is added to them and keeps the groups they are already in.
- Marketing permissions: shown when the audience uses them. Pick the form field that grants each one. Any answer grants it, even "No", so use a checkbox or consent field. If Mailchimp lists none yet, add a contact to the audience, then click Reload from Mailchimp.
Click Save, then update the form. Add more actions to reach more audiences. Each action has a switch to turn it off, and Edit Mailchimp action and Remove Mailchimp action buttons. With Forms' conditional logic, an action can run only when the answers match. The XPAC Agent can add these actions for you too.
When a send fails
XPAC saves every submission first and sends it to Mailchimp in the background, so a Mailchimp problem never loses a submission. Each send is listed under XPAC → Forms → Deliveries:
- Delivered: Mailchimp took it. A note says when something was left out, such as an answer the audience has no field for, or a returning contact who stays unsubscribed.
- Waiting: queued, or waiting to try again. When Mailchimp is busy or can't be reached, XPAC tries again after about 1, 5, 30 and 120 minutes.
- Failed: every try failed, or Mailchimp refused this contact, for example a fake address or one that asked to be forgotten. The row says why.
- Skipped: there was nothing to send, such as a submission with no email address.
- Dismissed: you dismissed it, or the submission is in spam or the trash.
Retry now sends a failed or dismissed delivery again with the form's current settings and the API key saved now. Actions that already went through are not sent again unless you edited them since.
If five deliveries in a row fail because of the account or the connection, such as a revoked key or a deleted audience, XPAC pauses Mailchimp on that form. A problem with one person's answers never counts. While it is paused, submissions are still saved but show as Failed, and the site's admin email address gets one email about it. XPAC still tries one submission an hour, and Mailchimp starts sending again on its own if that one goes through. To resume now, fix the cause and click Resume and retry on the Deliveries screen. It sends the failed submissions again with the form's current settings.
For developers
| Hook | Type | What it does |
|---|---|---|
xpac_mailchimp_request_timeout | Filter | Seconds to wait for Mailchimp. Default 10. |
xpac_mailchimp_report_dropped_fields | Filter | Whether a delivery notes answers Mailchimp dropped. Default true. Gets the audience ID. |
xpac_mailchimp_permission_sample | Filter | How many contacts are read to find an audience's marketing permissions. Default 100. |
xpac_mailchimp_webhook_registration | Filter | The webhook settings sent to Mailchimp for each audience. |
xpac_forms_mailchimp_webhook | Action | Every webhook event. Gets the type, the event data and the email. |
xpac_forms_mailchimp_contact_opted_out | Action | A contact unsubscribed or was cleaned. Gets the email, the type and the event data. |
xpac_forms_mailchimp_contact_email_changed | Action | A contact changed their address. Gets the old email, the new email and the event data. |