I’m connecting my nodejs backend with Mailchimp via API and everything works great but one thing:
The problem:
When I update existing member information (using method "PATCH"), it does not update/add the Tag in the dashboard.
The discovery:
I’m using a Mailchimp API wrapper npm package called ‘mailchimp_marketing’ wherein i discovered its sending a patch request internally to the Mailchimp API
From this package, I use an add tags function with the specified query and body params. I get a response of 200 but I don’t see it updating on my Mailchimp dashboard
I have been referring to the below links of Mailchimp docs:-
adding or updating members-nodejs
The code:
const email = "xyz@gmail.com";
const listId = "abcdefghij";
const subscriberHash = md5(email.toLowerCase()); //md5 hash of email
async function run() {
const response = await mailchimp.lists.updateListMemberTags(
listId,
subscriberHash,
{
tags: [
{
name: "Test",
status: "active",
},
],
}
);
console.log(
response //logs null and status 200
);
}
run();
Ouput of the above code :
null
It does not update the tag of the user in the Mailchimp dashboard
It would be nice if anyone can suggest what to do or some workarounds.
The function ‘updateListMemberTags’ is failing to update it in the dashboard since it needs a body tag to be wrapped around it.
Source: Mailchimp API silently failing
Final Code: