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('my@email.com'),
{ tags: [{ name: 'Tag Name', status: 'active' }] }
);
(resp === null) // true
getListMemberTags
successfully)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.)
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('my@email.com'),
{ body: { tags: [{ name: 'Tag Name', status: 'active' }] } }
);