phongyewtong
phongyewtong

Reputation: 5309

How to send mailchimp templates with mandrill?

How to send mailchimp templates with mandrill?

i have build a template in Mailchimp and send to mandrill. enter image description here

when I called this API, it sent a plain email without the template. how to send with the template?

const response = await mailchimp.messages.send({
            template_name:"Test",
            message: {
                from_email: "[email protected]",
                subject: "Hello world",
                text: "Welcome to Mailchimp Transactional!",
                to: [{
                    email: "[email protected]",
                    type: "to"
                }]
            }
        });

Upvotes: 0

Views: 2041

Answers (2)

SyraKozZ
SyraKozZ

Reputation: 659

you must use .messages.sendTemplate not .messages.send

Upvotes: 1

phongyewtong
phongyewtong

Reputation: 5309

i figure it out, you have to add a empty content field

const response = await mailchimp.messages.send({
            template_name:"Test",
            template_content: [],<--------ADD THIS
            message: {
                from_email: "[email protected]",
                subject: "Hello world",
                text: "Welcome to Mailchimp Transactional!",
                to: [{
                    email: "[email protected]",
                    type: "to"
                }]
            }
        });

Upvotes: 0

Related Questions