Skip to content
RoughFigure

How to add website leads to Mailchimp (with consent)

Add customers who opt in to your Mailchimp audience with the API, without resubscribing people who left. Your API key, data centre and audience ID.

RoughFigure2 min read
Illustration of an email envelope
On this page
  1. Who should go into Mailchimp
  2. Find your key and audience ID
  3. Add the subscriber
  4. Why not PUT (add or update)?
  5. Single or double opt-in?
  6. Doing it in RoughFigure
  7. Questions

To add website leads to Mailchimp, create an API key (it ends with your data centre, like -us21), copy your Audience ID, and add each person to /lists/{audience_id}/members on https://<dc>.api.mailchimp.com/3.0. Only add people who ticked a box agreeing to hear from you, and don’t resubscribe anyone who unsubscribed before.

Who should go into Mailchimp

A customer asking for a fencing price has agreed to hear about their fence. They haven’t agreed to your spring offers. Put a separate, unticked box on your form (“Send me occasional tips and offers”) and only send those who tick it to Mailchimp. Everyone else belongs in your CRM or lead list. Consent for CRM and newsletter leads covers the rules.

Find your key and audience ID

  1. Profile icon → Account & billing → Extras → API keys → Create a key. The part after the dash is your data centre.
  2. Audience → Settings → Audience name and defaults shows the Audience ID.

Add the subscriber

POST https://us21.api.mailchimp.com/3.0/lists/<audience_id>/members
Authorization: Bearer <your API key>
Content-Type: application/json

{
  "email_address": "[email protected]",
  "status": "subscribed",
  "merge_fields": { "FNAME": "Daniel", "LNAME": "Price" },
  "tags": ["website-estimator"]
}

If the person is already in your audience, Mailchimp replies 400 “Member Exists”. That’s good: it means you haven’t changed the status of someone who might have unsubscribed. Treat it as done.

Why not PUT (add or update)?

PUT /lists/{id}/members/{hash} with status_if_new adds or updates in one call, and is handy for updating names. But if you send status: subscribed on an update, you can resubscribe someone who left, which breaks the law in many countries and Mailchimp’s rules. Use status_if_new only, and leave status out.

Single or double opt-in?

subscribed adds them straight away. pending sends a confirmation email first. Double opt-in gives you a cleaner list and stronger proof of consent; single opt-in loses fewer people. Either is fine with a clear, unticked box.

Doing it in RoughFigure

In RoughFigure we’ve built Mailchimp in as one of nine direct newsletter connections. Under Integrations → Add leads to your newsletter, choose Mailchimp, paste your API key and Audience ID, and click Connect. Only customers who ticked your marketing box and then confirmed by email are added, with their name. We send that confirmation ourselves, so leave Mailchimp’s own double opt-in off, and anyone who unsubscribed before is left alone. See the Mailchimp integration, or all integrations.

Questions

Why does my API key stop working after a while?

Keys are revoked if someone deletes them, or if Mailchimp spots one exposed in public code. Create a new one and update it wherever it’s used.

Can I add a tag to people who came from my website?

Yes. Add tags to the request, as above. Tags are free to use and don’t count as separate audiences.

Do contacts who don’t opt in count towards my Mailchimp bill?

Only if you add them. Keeping non-subscribers out of Mailchimp keeps your list, and your bill, smaller.

Keep reading

Give your next customer a rough figure tonight.

14 days free · No card needed · Set up for you, free