Patrick Perini
Patrick Perini

Reputation: 22633

Mailchimp tag API silently failing

I'm calling the Node.js Mailchimp API like so:

const mailchimp = require('@mailchimp/mailchimp_marketing');
const md5 = require('md5');

// ...

const resp = await mailchimp.lists.updateListMemberTags(
  mailchimpListId,
  md5('[email protected]'),
  { tags: [{ name: 'Tag Name', status: 'active' }] }
);

(resp === null) // true

But the response is null, and the tag is not being added to the subscriber.

Any ideas as to why it might be silently failing, and if so, how I can debug it?

(If relevant, this is all being run within an Auth0 Custom Action.)

Upvotes: 1

Views: 578

Answers (2)

hunter
hunter

Reputation: 31

If anyone is still experiencing this, here is the updated Documentation for this, and will be most up-to-date.

Mailchimp Docs

I just went in circles for like 4 hours before running into this fix. Hope it helps.

Upvotes: 0

Patrick Perini
Patrick Perini

Reputation: 22633

Thanks to Buck at Mailchimp, I found the solution. Unlike most API calls in the library, updateListMemberTags needs a body wrapper like so:

const resp = await mailchimp.lists.updateListMemberTags(
  mailchimpListId,
  md5('[email protected]'),
  { body: { tags: [{ name: 'Tag Name', status: 'active' }] } }
);

Upvotes: 0

Related Questions