Closed enzolutions closed 6 years ago
First thing to do is verify the list exists via a get call. http://developer.mailchimp.com/documentation/mailchimp/reference/lists/#
@thorning Thanks for your response.
Following your suggestion I create the following code to double check if the list is valid
console.log('/lists/' + mc_listid);
mailchimp.get({
path : '/lists/' + mc_listid
}).then(function (result) {
console.log('Valid list');
console.log(result)
})
.catch(function (err) {
console.log('Invalid list');
console.log(err)
});
At the begging I got the same error Error: The requested resource could not be found., then I started to questioning myself, maybe the list ID is not correct.
How I got the ID, easy from the URL when I was editing the list in my case, I got somethig in my browser like this.
https://us16.admin.mailchimp.com/lists/settings?id=XXXXX
So, I did some research and I found that is not the listid, to get you need to follow the steps explained in the documentation.
https://kb.mailchimp.com/lists/manage-contacts/find-your-list-id
The full example to double check the list and subscribe an email would be like
mailchimp.get({
path : '/lists/' + mc_listid
}).then(function (result) {
mailchimp.post('/lists/' + mc_listid + '/members', {
email_address : 'example@example.com',
status : 'subscribed'
})
.then(function(results) {
console.log('subscription works');
})
.catch(function (err) {
console.log('subscription fail');
console.log(err);
})
})
.catch(function (err) {
console.log(err)
});
Maybe I could check if already exist or not in the list
Hi folks
I am trying to add a new email into a mail list, but I always get the same error.
Here what I am trying.
But always the the following error
I am using the package inside MeteorJS, just in case that is relevant.
Thanks in advance.