sendinblue / APIv3-nodejs-library

SendinBlue's API v3 Node.js Library
ISC License
101 stars 47 forks source link

Send Template #25

Closed Dallas62 closed 6 years ago

Dallas62 commented 6 years ago

Hi!

I can not send mail with SendTemplate:

    const apiInstance = new SibApiV3Sdk.SMTPApi();

    apiInstance.sendTemplate(123, {
            emailTo: 'adress@domain.tld'
        })

Result:

{"code":"invalid_parameter","message":"valid emailTo is required"}

Of course, I provide a valid mail when I run the process.

ekta-slit commented 6 years ago

Hi @Dallas62

emailTo expects an array of email addresses & not string. So code should be like:

const apiInstance = new SibApiV3Sdk.SMTPApi();

    apiInstance.sendTemplate(123, {
            emailTo: ['adress@domain.tld']
        })

Refer https://developers.sendinblue.com/v3.0/reference#sendtemplate-1

Thanks

Dallas62 commented 6 years ago

Thanks! Will check this ASAP.

An idea: Make pre-validation of type or transformation into array might be done to avoid confusion.