Skip to content

Instantly share code, notes, and snippets.

@rohansen
Created December 7, 2018 08:29
Show Gist options
  • Save rohansen/3cad1e2168fc042bd04c4807d3d11099 to your computer and use it in GitHub Desktop.
Save rohansen/3cad1e2168fc042bd04c4807d3d11099 to your computer and use it in GitHub Desktop.
As i had a hard time finding anything in the mailchimp documentation, i thought it might help a lost soul to put this info here:
If you cannot find your marketing_permission_id of your mailchimp list (eg. for GDPR compliance), you can do a signup request (maybe others too),
using the API, and it will return its data, including the marketing_permissions array containing the unique id for the opt-in.
POST:
{
"email_address": "xxx@xxx.xx",
"status": "subscribed",
"status_if_new": "subscribed",
"merge_fields": {
"FNAME": "John",
"LNAME": "Doe",
"COUNTRY": "DK"
},
"marketing_permissions": [
{
"marketing_permission_id": "666b666b66",
"enabled": true
}
],
"interests": {
"000b000b00": false,
...
...
}
}
RETURNS:
...
{
"id": "XXXXXXXXXXXXXXX",
"email_address": "XXXXXXXXX",
"unique_email_id": "XXXXXXXXXX",
"email_type": "html",
"status": "subscribed",
"merge_fields": {
"B": "",
"COUNTRY": "DK"
},
"marketing_permissions": [
{
"marketing_permission_id": "----->ID-FOUND-HERE<-----",
"text": "Yes I would like to subscribe to the hummel newsletter with news and deals within hummel's product range. Read the terms and conditions here. You can unsubscribe at any time.",
"enabled": false
}
],
...
@cdnilanga
Copy link

Thank you

@zainzafar
Copy link

Is this still the only way to fetch the marketing_permission_id?

@rohansen
Copy link
Author

rohansen commented Jun 2, 2020

Is this still the only way to fetch the marketing_permission_id?

Hi zainzafar,

I haven't been around the Mailchimp API for quite a while, so i can't really answer that. However, a quick search in their docs and on google, didn't reveal any changes. I can't be sure though :-)

My experience with the detail level of their documentation, however, leads me to think this is unchanged.. unfortunately :-/

@akkis
Copy link

akkis commented Nov 11, 2020

Thank you! This is the only way to get marketing_permission_id's until now.

@scottybo
Copy link

scottybo commented Jun 3, 2021

Just a note that you can get the marketing_permission_id by doing a GET request on the List Members, or on a specific Member:

    "marketing_permissions": [
        {
            "marketing_permission_id": "abc123",
            "text": "Email",
            "enabled": true
        }
    ],

@rohansen
Copy link
Author

rohansen commented Jun 3, 2021

Just a note that you can get the marketing_permission_id by doing a GET request on the List Members, or on a specific Member:

    "marketing_permissions": [
        {
            "marketing_permission_id": "abc123",
            "text": "Email",
            "enabled": true
        }
    ],

Hi Scott,
Thanks for the heads up. I was unaware of this (and unsure if it was possible back when I needed it,since it was a while ago).
Sounds great though 😊
Br Ronni

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment