I'm using the node-mailchimp wrapper for the MailChimp API v2.
I get the following error when calling 'batch-subscribe' or 'batch-unsubscribe' from a function:
-100 'You must specify a id value'
Here's the function:
function doBatchUnsub(theRequest)
{
api.call('lists', 'batch-unsubscribe', theRequest, function (error, data)
{
if (error)
{
errorMessage(error);
}
else
{
console.log(JSON.stringify(data));
}
}
);
}
It actually works fine if I paste the following JSON into the theRequest parameter:
{
"apikey" : "my-key-us8",
"id" : "my-id",
"batch" : [
{
"email" : "example@gmail.com"
},
{
"email" : "example@yahoo.com"
}
],
"delete_member" : true,
"send_goodbye" : false,
"send_notify" : false
}
I only get the error when I pass the JSON into the function from another function. When I do a console.log(theRequest) I can see the exact same text is getting sent to MailChimp. It's confusing.
Any ideas?