Code written in Node.JS using node-mailchimp
I am attempting to create and send a campaign to a list in Mailchimp. But I am getting an error "Your Campaign is not ready to send.".
Code
mailchimp.request({
method : 'post',
path : '/campaigns',
body : {
"type": 'regular',
"recipients": {
"list_id": 'd73581bad5',
},
"settings": {
"subject_line": subject,
"template_id": result.id,
"from_name": "The Techonomics",
"from_email": "team@thetechonomics.com"
}
}
}, async function(err, result){
mailchimp.request({
method : 'post',
path : '/campaigns/'+result.id+'/actions/send',
}, async function(err, result){
console.log(err);
})
})
When I go to MailChimp, I see that the campaign has been added. but the "From" section is incomplete, even though I have set up the default from name and email address and I can see that when I click add from.
How can I be able to add this information automatically or ensure that they are populated programmatically?