maximo
maximo

Reputation: 1091

MailChimp v3 API - Adding to Groups

Is there a way to manage a subscribers' group preference for lists in the v3 API? MailChimp documentation is a little light on the subject.

Upvotes: 4

Views: 1901

Answers (2)

ckhatton
ckhatton

Reputation: 1572

Yes, by assigning the member to an interest.


You have to find out the ID of the group (called 'interests') that you are wanting to add to. Unfortunately this cannot be found anywhere on the MailChimp dashboard.

The easiest way to find out the 'interest' ID (rather than creating a script) is to go to the MailChimp playground and then, after entering in your API key, route to...

lists > the list in question > members (in the sub-resources dropdown)

then...

load (in the actions dropdown) for any member

or

Create Members (button)

The page will load the member's details. Scroll down until you see the 'interests' array/object. There you will see the IDs. Notice they can be set to true or false.

You will have to figure out which ID relates to what 'group'/'interest' by making the call, and then looking at the member's details via your MailChimp dashboard.

So when it comes to actually making the POST call ('member' create), you would want something on the lines of...

{
  "email_address":"[email protected]",
  "status":"subscribed",
  "interests": {
    "b8a9d7cbf6": true
  },
# ADDITIONAL FIELDS, IF REQUIRED...
  "merge_fields":{
    "FNAME": "foo bar",
    "LNAME": "foo bar",
    "MERGE3": "foo bar",
    "MERGE4": "foo bar"
  }
}

A PUT call ('member' edit) example...

{
  "interests": {
    "b8a9d7cbf6": false,
    "5998e44916": true
  }
}

For PUT requests, it seems that you must declare every 'interest' and state whether it is true or false.

Upvotes: 6

lehtu
lehtu

Reputation: 907

I think this is what you are looking for: Lists Interest Categories Collection

In that endpoint you can get and create new groups for lists. And here Lists Interests Collection you can get interests or create new ones.

Lemonades
    Coca Cola
    Pepsi Max
    Fanta

Lemonades represents category or better a group name. Cola, pepsi and fanta represents interests or better group items in that spesific group/category.

Hope this helps :)

Upvotes: -1

Related Questions