MailChimp API GDPR Fields

Alex Holsgrove picture Alex Holsgrove · May 1, 2018 · Viewed 7.9k times · Source

I have a newsletter form with name & email fields, which upon submitting gets sent to /api.mailchimp.com/3.0/lists/####/members using the MailChimp API.

From what I understand, the new GDPR fields that MailChimp have created don't seem to have an associated field tag meaning that they can't be assigned values using the API.

Is there a way to capture the user's consent with my existing form, and match these up to the MailChimp GDPR fields, or do I need to replace my form with a MailChimp embedded form instead?

Answer

Francesco Salvi picture Francesco Salvi · Aug 23, 2018

meaning that they can't be assigned values using the API.

It's actually possible to set the GDPR options values via API for a list member, the only problem is to know the different marketing_permission_ids in advance. One trick though can be to insert the member (or a dummy member) without specifying them, extract such ids from the response payload, and then do a second update call using such ids:

PUT https://usXX.api.mailchimp.com/3.0/lists/{{listId}}/members/{{subscriberHash}}

{
    "marketing_permissions": [
        {"marketing_permission_id": "12a69fa097", "enabled": true},  // 'Email' consent
        {"marketing_permission_id": "d0dc5969af", "enabled": false}  // 'Direct Mail' consent
    ]
}