0

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?

enter image description here

enter image description here

chidog12
  • 61
  • 1
  • 7
  • Did you solve this? I'm facing the same issue and it's blowing my mind! – Giuseppe Capoluongo Mar 18 '21 at 13:54
  • @GiuseppeCapoluongo Hey, I'm not 100% sure if this solved the issue. but I ended up reaching out to Mailchimp support and this was there response "Thanks for the reply. I was able to look further into this for you and the reply to and from need to be added to the request. That should look like this: `{ "recipients":{"list_id":"{{list_id}}"}, "type":"regular", "settings":{"subject_line":"API - Test", "reply_to":"examples@mailchimp.com", "from_name":"Test"}}` – chidog12 Mar 19 '21 at 14:59

0 Answers0